summaryrefslogtreecommitdiff
path: root/vala/valatypeofexpression.vala
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2019-10-23 14:21:49 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2019-10-23 14:21:49 +0200
commit8e91efb95498318e38a43877e26d401c11a897f2 (patch)
tree1fbfdc607dd7ab205b0dece1a663852dd9b02ce7 /vala/valatypeofexpression.vala
parentd6a65166410107b01618db5227c982b9137fc725 (diff)
downloadvala-8e91efb95498318e38a43877e26d401c11a897f2.tar.gz
vala: Issue warning when passing arrays to typeof(), except for "string[]"
Passing arrays resolve to G_TYPE_INVALID, and "string[]" to G_TYPE_STRV See https://gitlab.gnome.org/GNOME/vala/issues/868
Diffstat (limited to 'vala/valatypeofexpression.vala')
-rw-r--r--vala/valatypeofexpression.vala4
1 files changed, 4 insertions, 0 deletions
diff --git a/vala/valatypeofexpression.vala b/vala/valatypeofexpression.vala
index 5aa28e1fd..b63368100 100644
--- a/vala/valatypeofexpression.vala
+++ b/vala/valatypeofexpression.vala
@@ -86,6 +86,10 @@ public class Vala.TypeofExpression : Expression {
Report.warning (_data_type.source_reference, "Type argument list without effect");
}
+ if (_data_type is ArrayType && ((ArrayType) _data_type).element_type.type_symbol != context.analyzer.string_type.type_symbol) {
+ Report.warning (_data_type.source_reference, "Arrays do not have a `GLib.Type', with the exception of `string[]'");
+ }
+
return !error;
}