]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Check type-arguments in base-types/prerequisites of class/interface
authorRico Tzschichholz <ricotz@ubuntu.com>
Sat, 13 Feb 2021 13:47:03 +0000 (14:47 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 27 Feb 2021 19:19:14 +0000 (20:19 +0100)
Fixes https://gitlab.gnome.org/GNOME/vala/issues/404

tests/Makefile.am
tests/generics/arrays-not-supported-2.test [new file with mode: 0644]
tests/generics/arrays-not-supported-3.test [new file with mode: 0644]
vala/valaclass.vala
vala/valainterface.vala

index 1655968e72a698b1b6c8d495863f099c559fad8f..fccba9159d6c3879fee1c9108afb143eeeed6e7e 100644 (file)
@@ -649,6 +649,8 @@ TESTS = \
        asynchronous/variadic-invalid-2.test \
        asynchronous/yield.vala \
        generics/arrays-not-supported.test \
+       generics/arrays-not-supported-2.test \
+       generics/arrays-not-supported-3.test \
        generics/constructor-chain-up.vala \
        generics/floating-type-cast.vala \
        generics/inference-argument-may-fail.vala \
diff --git a/tests/generics/arrays-not-supported-2.test b/tests/generics/arrays-not-supported-2.test
new file mode 100644 (file)
index 0000000..3682da6
--- /dev/null
@@ -0,0 +1,10 @@
+Invalid Code
+
+interface Foo<T> : Object {
+}
+
+interface Bar : Object, Foo<int[]> {
+}
+
+void main () {
+}
diff --git a/tests/generics/arrays-not-supported-3.test b/tests/generics/arrays-not-supported-3.test
new file mode 100644 (file)
index 0000000..6ef20d3
--- /dev/null
@@ -0,0 +1,10 @@
+Invalid Code
+
+class Foo<T> : Object {
+}
+
+class Bar : Foo<int[]> {
+}
+
+void main () {
+}
index 33e9b113e5be588fc720ce029c249854b6a12254..194e3a8e5527b5b055d5604d5744c3a56d62da4a 100644 (file)
@@ -570,6 +570,7 @@ public class Vala.Class : ObjectTypeSymbol {
 
                foreach (DataType type in base_types) {
                        type.check (context);
+                       context.analyzer.check_type (type);
                }
 
                foreach (TypeParameter p in get_type_parameters ()) {
index 8da00f44667a8e297d783997a6e4807a9c97706f..06b7ee7e7470499b2858124d569cd9e18786a4c9 100644 (file)
@@ -202,6 +202,7 @@ public class Vala.Interface : ObjectTypeSymbol {
 
                foreach (DataType type in prerequisites) {
                        type.check (context);
+                       context.analyzer.check_type (type);
                }
 
                foreach (TypeParameter p in get_type_parameters ()) {