Add a typeName() method to each type for error printing purposes.
Test: compiles with mma
Change-Id: I1283c395440282fde1106ad47aa185bdeda75880
diff --git a/hidl-gen_y.yy b/hidl-gen_y.yy
index 85c0b8e..e44e488 100644
--- a/hidl-gen_y.yy
+++ b/hidl-gen_y.yy
@@ -940,9 +940,9 @@
: fqtype { $$ = $1; }
| TEMPLATED '<' type '>'
{
- if (!$1->isVector() && $3->isBinder()) {
- std::cerr << "ERROR: TemplatedType of interface types are not "
- << "supported. at " << @3 << "\n";
+ if (!$1->isCompatibleElementType($3)) {
+ std::cerr << "ERROR: " << $1->typeName() << " of " << $3->typeName()
+ << " is not supported. at " << @3 << "\n";
YYERROR;
}
@@ -951,13 +951,19 @@
}
| TEMPLATED '<' TEMPLATED '<' type RSHIFT
{
- if ($5->isBinder()) {
- std::cerr << "ERROR: TemplatedType of interface types are not "
- << "supported. at " << @5 << "\n";
+ if (!$3->isCompatibleElementType($5)) {
+ std::cerr << "ERROR: " << $3->typeName() << " of " << $5->typeName()
+ << " is not supported. at " << @3 << "\n";
YYERROR;
}
$3->setElementType($5);
+ if (!$1->isCompatibleElementType($3)) {
+ std::cerr << "ERROR: " << $1->typeName() << " of " << $3->typeName()
+ << " is not supported. at " << @3 << "\n";
+
+ YYERROR;
+ }
$1->setElementType($3);
$$ = $1;
}