]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Explicitly include header for length-type of arrays
authorRico Tzschichholz <ricotz@ubuntu.com>
Sat, 1 Feb 2020 15:29:59 +0000 (16:29 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 1 Feb 2020 15:39:51 +0000 (16:39 +0100)
codegen/valaccodebasemodule.vala
tests/Makefile.am
tests/arrays/length-type-include.vala [new file with mode: 0644]

index 31ac415d90c90220dbe6fb46b88cb327057682e7..ee1c4fbb15dc2997efbc338731751b7d67f0f1f4 100644 (file)
@@ -1553,6 +1553,9 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                } else if (type is ArrayType) {
                        var array_type = (ArrayType) type;
                        generate_type_declaration (array_type.element_type, decl_space);
+                       if (array_type.length_type != null) {
+                               generate_type_declaration (array_type.length_type, decl_space);
+                       }
                } else if (type is ErrorType) {
                        var error_type = (ErrorType) type;
                        if (error_type.error_domain != null) {
index 14e85507135533e844c916ef4a2483cbebecd54f..7166e74e0e4dd4450adb912c94111b66c36e725e 100644 (file)
@@ -83,6 +83,7 @@ TESTS = \
        arrays/inline-parameter.test \
        arrays/inline-struct-field.test \
        arrays/length-inline-assignment.vala \
+       arrays/length-type-include.vala \
        arrays/struct-field-length-cname.vala \
        arrays/incompatible-integer-elements.test \
        arrays/slice-invalid-start.test \
diff --git a/tests/arrays/length-type-include.vala b/tests/arrays/length-type-include.vala
new file mode 100644 (file)
index 0000000..63e2ad2
--- /dev/null
@@ -0,0 +1,3 @@
+void main () {
+       unowned void*[] foo = null;
+}