[vala/0.36] Fix recursive declaration in generic base type



commit 5cb7ec8ce1bd3eed02d67252fa4311d8adf10bd9
Author: Simon Werbeck <simon werbeck gmail com>
Date:   Mon Apr 1 01:16:21 2013 +0200

    Fix recursive declaration in generic base type
    
    https://bugzilla.gnome.org/show_bug.cgi?id=688732

 tests/Makefile.am            |    1 +
 tests/structs/bug688732.vala |    9 +++++++++
 vala/valasymbolresolver.vala |    5 +++++
 3 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index fee9515..c77c2fb 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -163,6 +163,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
index 0000000..49295d6
--- /dev/null
+++ b/tests/structs/bug688732.vala
@@ -0,0 +1,9 @@
+struct Foo<T> {
+       public T t;
+}
+
+struct Bar : Foo<Bar> {
+}
+
+void main () {
+}
diff --git a/vala/valasymbolresolver.vala b/vala/valasymbolresolver.vala
index 32c84e4..db31aa0 100644
--- a/vala/valasymbolresolver.vala
+++ b/vala/valasymbolresolver.vala
@@ -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;
 


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