[vala/0.48] vala: Check type-arguments in base-types/prerequisites of class/interface



commit 069fd7240e8104d7f36717f5793051c933e882d7
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sat Feb 13 14:47:03 2021 +0100

    vala: Check type-arguments in base-types/prerequisites of class/interface
    
    Fixes https://gitlab.gnome.org/GNOME/vala/issues/404

 tests/Makefile.am                          |  2 ++
 tests/generics/arrays-not-supported-2.test | 10 ++++++++++
 tests/generics/arrays-not-supported-3.test | 10 ++++++++++
 vala/valaclass.vala                        |  1 +
 vala/valainterface.vala                    |  1 +
 5 files changed, 24 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 20298a92c..6ce646e58 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -640,6 +640,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
index 000000000..3682da652
--- /dev/null
+++ b/tests/generics/arrays-not-supported-2.test
@@ -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
index 000000000..6ef20d35d
--- /dev/null
+++ b/tests/generics/arrays-not-supported-3.test
@@ -0,0 +1,10 @@
+Invalid Code
+
+class Foo<T> : Object {
+}
+
+class Bar : Foo<int[]> {
+}
+
+void main () {
+}
diff --git a/vala/valaclass.vala b/vala/valaclass.vala
index c1270442d..f01d09914 100644
--- a/vala/valaclass.vala
+++ b/vala/valaclass.vala
@@ -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 ()) {
diff --git a/vala/valainterface.vala b/vala/valainterface.vala
index 8da00f446..06b7ee7e7 100644
--- a/vala/valainterface.vala
+++ b/vala/valainterface.vala
@@ -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 ()) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]