From: Rico Tzschichholz Date: Sun, 12 Mar 2017 21:33:34 +0000 (+0100) Subject: codegen: Property equality check can't be applied to non-automatic-bodies X-Git-Tag: 0.35.90~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=04489bc5ee34edfa2024f910a81c24bc9308c191;p=thirdparty%2Fvala.git codegen: Property equality check can't be applied to non-automatic-bodies This is check was introduced with 64b9bfc1bc0abfed45ad07a8ebaef8a5f167f848 https://bugzilla.gnome.org/show_bug.cgi?id=779955 --- diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala index 3a68264d2..6c4755a3e 100644 --- a/codegen/valaccodebasemodule.vala +++ b/codegen/valaccodebasemodule.vala @@ -1779,7 +1779,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator { notify_call.add_argument (get_property_canonical_cconstant (prop)); var get_accessor = prop.get_accessor; - if (get_accessor != null) { + if (get_accessor != null && get_accessor.automatic_body) { var property_type = prop.property_type; var get_call = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_real_name (get_accessor))); get_call.add_argument (new CCodeIdentifier (is_virtual ? "base" : "self")); diff --git a/tests/Makefile.am b/tests/Makefile.am index 4360e5eab..b1d3ea299 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -220,6 +220,7 @@ TESTS = \ objects/bug779038-2.test \ objects/bug779038-3.test \ objects/bug779219.vala \ + objects/bug779955.vala \ errors/errors.vala \ errors/bug567181.vala \ errors/bug579101.vala \ diff --git a/tests/objects/bug779955.vala b/tests/objects/bug779955.vala new file mode 100644 index 000000000..e67ef0ca8 --- /dev/null +++ b/tests/objects/bug779955.vala @@ -0,0 +1,20 @@ +public class Foo : Object { + int i = 42; + + public int bar { + get { + return i; + } + set { + if (value == 42) { + i = 23; + } + } + } +} + +void main () { + var f = new Foo (); + f.bar = 42; + assert (f.bar == 23); +}