nested types: generic types can't have nested types.
Bug: 201639797
Test: aidl_unittests
Change-Id: I5cf974681ffa34bfe8eda7312217d3b1ce97bc04
diff --git a/aidl_unittest.cpp b/aidl_unittest.cpp
index e3a761b..10e8044 100644
--- a/aidl_unittest.cpp
+++ b/aidl_unittest.cpp
@@ -1619,6 +1619,18 @@
HasSubstr("Unstructured parcelables should be at the root scope"));
}
+TEST_F(AidlTest, RejectGenericTypeWithNestedTypes) {
+ const string input_path = "p/Foo.aidl";
+ const string input =
+ "package p;\n"
+ "parcelable Foo<T> {\n"
+ " parcelable Bar {}\n"
+ "}";
+ CaptureStderr();
+ EXPECT_EQ(nullptr, Parse(input_path, input, typenames_, Options::Language::CPP));
+ EXPECT_THAT(GetCapturedStderr(), HasSubstr("Generic types can't have nested types."));
+}
+
TEST_F(AidlTest, HandleSyntaxErrorsInNestedDecl) {
const string input_path = "p/IFoo.aidl";
const string input =