]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: length-type of arrays must not be nullable
authorRico Tzschichholz <ricotz@ubuntu.com>
Thu, 15 Apr 2021 14:49:14 +0000 (16:49 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 28 Apr 2021 06:45:37 +0000 (08:45 +0200)
vala/valaarraycreationexpression.vala
vala/valaarraytype.vala

index c3a20adf9a1ef08cbbea76213164c17c687a8b3b..2ee80b4d54f8a0206ba8ddec9f73824bb54b536a 100644 (file)
@@ -258,7 +258,7 @@ public class Vala.ArrayCreationExpression : Expression {
                        length_type = context.analyzer.int_type.copy ();
                } else {
                        length_type.check (context);
-                       if (!(length_type is IntegerType)) {
+                       if (!(length_type is IntegerType) || length_type.nullable) {
                                error = true;
                                Report.error (length_type.source_reference, "Expected integer type as length type of array");
                        }
index 8b6dcf5ef46cfbee3e635ec53d008ffc9ab590ce..06ba5841fa6135f8d06272fd7c5a79cc15373b5f 100644 (file)
@@ -319,7 +319,7 @@ public class Vala.ArrayType : ReferenceType {
                        length_type = context.analyzer.int_type.copy ();
                } else {
                        length_type.check (context);
-                       if (!(length_type is IntegerType)) {
+                       if (!(length_type is IntegerType) || length_type.nullable) {
                                error = true;
                                Report.error (length_type.source_reference, "Expected integer type as length type of array");
                                return false;