Emit error if function is overloaded.
Test: check error is reported correclty, hidl_test
Bug: 31758541
Change-Id: If82cb3fbd8c068c6e25cbc131a8102e24cf83988
diff --git a/hidl-gen_y.yy b/hidl-gen_y.yy
index b79f195..3e1fb98 100644
--- a/hidl-gen_y.yy
+++ b/hidl-gen_y.yy
@@ -341,7 +341,12 @@
| interface_declarations method_declaration
{
Interface *iface = static_cast<Interface *>(ast->scope());
- iface->addMethod($2);
+ if (!iface->addMethod($2)) {
+ std::cerr << "ERROR: Unable to add method '" << $2->name()
+ << "' at " << @2 << "\n";
+
+ YYERROR;
+ }
}
;