summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2021-04-15 16:49:14 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2021-04-28 08:45:37 +0200
commit81c3a5b9a0426ca845598336ff5b8ce2c7cf8c74 (patch)
treec93e0b5e5e0413a6720768ed1aa7a37c30101603
parentd393dd589a38b79b5386a174eefb6cce46b68a50 (diff)
downloadvala-81c3a5b9a0426ca845598336ff5b8ce2c7cf8c74.tar.gz
vala: length-type of arrays must not be nullable
-rw-r--r--vala/valaarraycreationexpression.vala2
-rw-r--r--vala/valaarraytype.vala2
2 files changed, 2 insertions, 2 deletions
diff --git a/vala/valaarraycreationexpression.vala b/vala/valaarraycreationexpression.vala
index c3a20adf9..2ee80b4d5 100644
--- a/vala/valaarraycreationexpression.vala
+++ b/vala/valaarraycreationexpression.vala
@@ -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");
}
diff --git a/vala/valaarraytype.vala b/vala/valaarraytype.vala
index 8b6dcf5ef..06ba5841f 100644
--- a/vala/valaarraytype.vala
+++ b/vala/valaarraytype.vala
@@ -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;