From: Jürg Billeter Date: Thu, 20 Nov 2008 21:37:35 +0000 (+0000) Subject: Check types in property assignments, fixes bug 550088 X-Git-Tag: VALA_0_5_2~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f7513fce1e090accc1e5084b86e49cd52869856;p=thirdparty%2Fvala.git Check types in property assignments, fixes bug 550088 2008-11-20 Jürg Billeter * vala/valaassignment.vala: Check types in property assignments, fixes bug 550088 svn path=/trunk/; revision=2042 --- diff --git a/ChangeLog b/ChangeLog index 5ae96a51e..34020b1b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-11-20 Jürg Billeter + + * vala/valaassignment.vala: + + Check types in property assignments, fixes bug 550088 + 2008-11-20 Jürg Billeter * vala/valacatchclause.vala: diff --git a/vala/valaassignment.vala b/vala/valaassignment.vala index f45a95e28..d3ad077f7 100644 --- a/vala/valaassignment.vala +++ b/vala/valaassignment.vala @@ -301,7 +301,9 @@ public class Vala.Assignment : Expression { Report.error (source_reference, "Assignment: Invalid callback assignment attempt"); return false; } - } else if (left.value_type != null && right.value_type != null) { + } + + if (left.value_type != null && right.value_type != null) { /* if there was an error on either side, * i.e. {left|right}.value_type == null, skip type check */ @@ -311,18 +313,20 @@ public class Vala.Assignment : Expression { return false; } - if (right.value_type.is_disposable ()) { - /* rhs transfers ownership of the expression */ - if (!(left.value_type is PointerType) && !left.value_type.value_owned) { - /* lhs doesn't own the value */ - error = true; - Report.error (source_reference, "Invalid assignment from owned expression to unowned variable"); + if (!(ma.symbol_reference is Property)) { + if (right.value_type.is_disposable ()) { + /* rhs transfers ownership of the expression */ + if (!(left.value_type is PointerType) && !left.value_type.value_owned) { + /* lhs doesn't own the value */ + error = true; + Report.error (source_reference, "Invalid assignment from owned expression to unowned variable"); + } + } else if (left.value_type.value_owned) { + /* lhs wants to own the value + * rhs doesn't transfer the ownership + * code generator needs to add reference + * increment calls */ } - } else if (left.value_type.value_owned) { - /* lhs wants to own the value - * rhs doesn't transfer the ownership - * code generator needs to add reference - * increment calls */ } } } else if (left is ElementAccess) {