diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2021-02-21 10:40:25 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2021-02-21 10:40:25 +0100 |
commit | 5cc60c1ddfebaf05483370913f28b4074345667b (patch) | |
tree | 611226cca53216846af207c887d67fcf9584f6db /vala/valabinaryexpression.vala | |
parent | 591a66a37ce30f9713a5d14e065663959447cc1e (diff) | |
download | vala-5cc60c1ddfebaf05483370913f28b4074345667b.tar.gz |
vala: Infer needle type for "in" expression on enum
Fixes https://gitlab.gnome.org/GNOME/vala/issues/1138
Diffstat (limited to 'vala/valabinaryexpression.vala')
-rw-r--r-- | vala/valabinaryexpression.vala | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/vala/valabinaryexpression.vala b/vala/valabinaryexpression.vala index f831c7cb7..9fcefde30 100644 --- a/vala/valabinaryexpression.vala +++ b/vala/valabinaryexpression.vala @@ -303,6 +303,11 @@ public class Vala.BinaryExpression : Expression { && (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 |