diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2021-11-17 18:46:22 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2021-11-17 18:46:22 +0100 |
commit | 16840d25fb474f313e98989856fc315149f3b73e (patch) | |
tree | afe6f728a4b7a529cd458827a7dc5fd30c1ef530 /vala | |
parent | 5b6345a6386b05aaf3f11cb3572940413eb878a8 (diff) | |
download | vala-16840d25fb474f313e98989856fc315149f3b73e.tar.gz |
vala: Check for unavailable value-type of variable initializer
Regression of 6690ea0e3c6f0d81d849e13548efc8c0809149cc
Fixes https://gitlab.gnome.org/GNOME/vala/issues/1253
Diffstat (limited to 'vala')
-rw-r--r-- | vala/valaassignment.vala | 4 | ||||
-rw-r--r-- | vala/valalocalvariable.vala | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/vala/valaassignment.vala b/vala/valaassignment.vala index 46f9445a4..137361b28 100644 --- a/vala/valaassignment.vala +++ b/vala/valaassignment.vala @@ -297,6 +297,10 @@ public class Vala.Assignment : Expression { Report.error (source_reference, "Assignment: Invalid assignment attempt"); return false; } + } else if (ma.symbol_reference is Variable && right.value_type == null) { + error = true; + Report.error (source_reference, "Assignment: Invalid assignment attempt"); + return false; } else if (ma.symbol_reference is Variable) { unowned Variable variable = (Variable) ma.symbol_reference; unowned ArrayType? variable_array_type = variable.variable_type as ArrayType; diff --git a/vala/valalocalvariable.vala b/vala/valalocalvariable.vala index e6d15cf19..024b046fe 100644 --- a/vala/valalocalvariable.vala +++ b/vala/valalocalvariable.vala @@ -209,6 +209,10 @@ public class Vala.LocalVariable : Variable { Report.error (source_reference, "expression type not allowed as initializer"); return false; } + } else if (initializer.value_type == null) { + error = true; + Report.error (source_reference, "expression type not allowed as initializer"); + return false; } if (!initializer.value_type.compatible (variable_type)) { |