[vala/0.48] vala: length-type of arrays must not be nullable



commit 35be15a1c923791a331da04dc04a3a59df314e03
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Thu Apr 15 16:49:14 2021 +0200

    vala: length-type of arrays must not be nullable

 vala/valaarraycreationexpression.vala | 2 +-
 vala/valaarraytype.vala               | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/vala/valaarraycreationexpression.vala b/vala/valaarraycreationexpression.vala
index 5e0f46172..c16808c61 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 7fff66b04..50f40721b 100644
--- a/vala/valaarraytype.vala
+++ b/vala/valaarraytype.vala
@@ -317,7 +317,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;


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