]> 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>
Mon, 16 Apr 2018 19:02:19 +0000 (21:02 +0200)
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 14774b5034edcade159ed4e5b03861fb54eb3f56..f0b59b9fcaf841156b9f5f813001e6eb17a6564f 100644 (file)
@@ -131,6 +131,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;