]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix generated code for stack-allocated arrays
authorJürg Billeter <j@bitron.ch>
Fri, 2 Oct 2009 21:46:29 +0000 (23:46 +0200)
committerJürg Billeter <j@bitron.ch>
Fri, 2 Oct 2009 21:46:29 +0000 (23:46 +0200)
Fixes bug 595751.

tests/Makefile.am
tests/basic-types/bug595751.vala [new file with mode: 0644]
vala/valasymbolresolver.vala

index eb19c7fbd60807f8eb50be656e05cfc22398b64b..d18a993346c3537ab431e1ccad6a1a2d4ab5dd60 100644 (file)
@@ -20,6 +20,7 @@ TESTS = \
        basic-types/strings.vala \
        basic-types/arrays.vala \
        basic-types/pointers.vala \
+       basic-types/bug595751.vala \
        basic-types/bug596637.vala \
        basic-types/bug596785.vala \
        namespaces.vala \
diff --git a/tests/basic-types/bug595751.vala b/tests/basic-types/bug595751.vala
new file mode 100644 (file)
index 0000000..c57d4e9
--- /dev/null
@@ -0,0 +1,3 @@
+void main () {
+        int a[2];
+}
index 213bd531835bbea5611475545759c200347c3955..09a9c19ccab7fb8945067289dbb7743967b84c82 100644 (file)
@@ -350,7 +350,12 @@ public class Vala.SymbolResolver : CodeVisitor {
        public override void visit_local_variable (LocalVariable local) {
                local.accept_children (this);
                if (local.variable_type is ReferenceType) {
-                       local.variable_type.nullable = true;
+                       var array_type = local.variable_type as ArrayType;
+                       if (array_type != null && array_type.fixed_length) {
+                               // local fixed length arrays are not nullable
+                       } else {
+                               local.variable_type.nullable = true;
+                       }
                }
        }