summaryrefslogtreecommitdiff
path: root/vala/valabinaryexpression.vala
diff options
context:
space:
mode:
authorJeremy Philippe <jeremy.philippe@gmail.com>2020-01-07 22:05:57 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2020-01-08 15:01:21 +0100
commit7850210bafcdd81f5b7a36b82766ae73f0fa0610 (patch)
tree433ac354f51153d122dc3af151793cfd83502d4d /vala/valabinaryexpression.vala
parentce690e98c96aa610408bf23512acf93ec38990ee (diff)
downloadvala-7850210bafcdd81f5b7a36b82766ae73f0fa0610.tar.gz
vala: Infer target_type in coalescing expressions
Correctly handle reference tranfers of inner expressions. Fixes https://gitlab.gnome.org/GNOME/vala/issues/892
Diffstat (limited to 'vala/valabinaryexpression.vala')
-rw-r--r--vala/valabinaryexpression.vala5
1 files changed, 5 insertions, 0 deletions
diff --git a/vala/valabinaryexpression.vala b/vala/valabinaryexpression.vala
index 4f1f642f5..fe559e1d5 100644
--- a/vala/valabinaryexpression.vala
+++ b/vala/valabinaryexpression.vala
@@ -189,6 +189,11 @@ public class Vala.BinaryExpression : Expression {
}
if (operator == BinaryOperator.COALESCE) {
+ if (target_type != null) {
+ left.target_type = target_type.copy ();
+ right.target_type = target_type.copy ();
+ }
+
if (!left.check (context)) {
error = true;
return false;