]> 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>
Sat, 17 Feb 2018 15:30:30 +0000 (16:30 +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 7ccc8756e113f07f7edc714014852eab14c0fed4..ed90923e944feb379764c85486308c2d8d0cfd8a 100644 (file)
@@ -192,6 +192,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 53ad7282150b1b888e6ac92f2ee024f0a4e4b78d..8b7f75cd349331d6e6e239130e510c67deac44b9 100644 (file)
@@ -270,6 +270,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;