]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix recursive declaration in generic base type
authorSimon Werbeck <simon.werbeck@gmail.com>
Sun, 31 Mar 2013 23:16:21 +0000 (01:16 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Fri, 2 Mar 2018 15:11:44 +0000 (16:11 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=688732

tests/Makefile.am
tests/structs/bug688732.vala [new file with mode: 0644]
vala/valasymbolresolver.vala

index 6e681af7c80103eeba44d592479c75f94bcd45bd..ef62b1bf99983102afcaa1450627f2b3003fe4b5 100644 (file)
@@ -164,6 +164,7 @@ TESTS = \
        structs/bug669580.vala \
        structs/bug685177.vala \
        structs/bug686190.vala \
+       structs/bug688732.vala \
        structs/bug690380.vala \
        structs/bug694140.vala \
        structs/bug749952.vala \
diff --git a/tests/structs/bug688732.vala b/tests/structs/bug688732.vala
new file mode 100644 (file)
index 0000000..49295d6
--- /dev/null
@@ -0,0 +1,9 @@
+struct Foo<T> {
+       public T t;
+}
+
+struct Bar : Foo<Bar> {
+}
+
+void main () {
+}
index 32c84e4c3b8a65e6714fe4236e9e17646d6873f5..db31aa0cea735b877b6059509a1eff892d7df002 100644 (file)
@@ -267,6 +267,11 @@ public class Vala.SymbolResolver : CodeVisitor {
                if (st.base_type != null) {
                        // make sure that base type is resolved
 
+                       if (current_scope == st.scope) {
+                               // recursive declaration in generic base type
+                               return new StructValueType (st);
+                       }
+
                        var old_scope = current_scope;
                        current_scope = st.scope;