Be a little smarter about dealing with TypeDefs, resolve to the typedef'd

target at lookup time, so all code ever sees is anything _but_ TypeDefs.
Also verify that the optional Enum storage type is valid (i.e. an enum
or an integer type) and re-emit enum values for derived enum types.
diff --git a/hidl-gen_y.yy b/hidl-gen_y.yy
index 81151a7..4f640ce 100644
--- a/hidl-gen_y.yy
+++ b/hidl-gen_y.yy
@@ -162,7 +162,6 @@
               YYERROR;
           }
 
-          // XXX What if $3 was a typedef _pointing_ to an interface...
           Interface *iface = new Interface(static_cast<Interface *>($3));
 
           // Register interface immediately so it can be referenced inside
@@ -331,7 +330,15 @@
 
 opt_storage_type
     : /* empty */ { $$ = NULL; }
-    | ':' fqname { $$ = $2; }
+    | ':' fqname
+      {
+          $$ = $2;
+
+          if ($$ != NULL && !$$->isValidEnumStorageType()) {
+              fprintf(stderr, "Invalid enum storage type specified.\n");
+              YYABORT;
+          }
+      }
     ;
 
 opt_comma