summaryrefslogtreecommitdiff
path: root/vala/valatypecheck.vala
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2018-11-27 14:24:03 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2018-11-27 14:26:37 +0100
commitf2682b111fd69228b6a91b64065b3b26c684f3b3 (patch)
tree5cbb9a6e8bade0068aa15ee14741cffec09cb87c /vala/valatypecheck.vala
parentfe05325a58398ed5be1dc15c73267fedd5bff8f6 (diff)
downloadvala-f2682b111fd69228b6a91b64065b3b26c684f3b3.tar.gz
vala: Type check for errors require an error expression
Fixes https://gitlab.gnome.org/GNOME/vala/issues/362
Diffstat (limited to 'vala/valatypecheck.vala')
-rw-r--r--vala/valatypecheck.vala6
1 files changed, 6 insertions, 0 deletions
diff --git a/vala/valatypecheck.vala b/vala/valatypecheck.vala
index 904311d54..3674b5c45 100644
--- a/vala/valatypecheck.vala
+++ b/vala/valatypecheck.vala
@@ -116,6 +116,12 @@ public class Vala.TypeCheck : Expression {
return false;
}
+ if (type_reference is ErrorType && !(expression.value_type is ErrorType)) {
+ Report.error (expression.source_reference, "`%s' must be an error".printf (expression.to_string ()));
+ error = true;
+ return false;
+ }
+
if (context.profile == Profile.GOBJECT && type_reference.has_type_arguments ()) {
Report.warning (_data_type.source_reference, "Type argument list has no effect");
}