Fixes https://gitlab.gnome.org/GNOME/vala/issues/1138
enums/enums.vala \
enums/flags.vala \
enums/from-0-literal.vala \
+ enums/in-inference.vala \
enums/no_gtype_to_string.vala \
enums/switch.vala \
enums/bug666035.vala \
--- /dev/null
+[Flags]
+enum Foo {
+ FOO,
+ BAR,
+ MANAM;
+}
+
+void main () {
+ Foo foo = FOO | BAR;
+ if (MANAM in foo) {
+ assert_not_reached ();
+ }
+ assert (BAR in foo);
+}
&& (operator == BinaryOperator.BITWISE_AND || operator == BinaryOperator.BITWISE_OR)) {
left.target_type = target_type.copy ();
right.target_type = target_type.copy ();
+ } else if (operator == BinaryOperator.IN) {
+ right.check (context);
+ if (right.value_type.type_symbol is Enum) {
+ left.target_type = right.value_type.copy ();
+ }
}
left.check (context);
if (left.value_type != null && left.value_type.type_symbol is Enum