]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Property equality check can't be applied to non-automatic-bodies
authorRico Tzschichholz <ricotz@ubuntu.com>
Sun, 12 Mar 2017 21:33:34 +0000 (22:33 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sun, 12 Mar 2017 21:33:34 +0000 (22:33 +0100)
This is check was introduced with 64b9bfc1bc0abfed45ad07a8ebaef8a5f167f848

https://bugzilla.gnome.org/show_bug.cgi?id=779955

codegen/valaccodebasemodule.vala
tests/Makefile.am
tests/objects/bug779955.vala [new file with mode: 0644]

index 3a68264d20d73a24f05a184683267c372974efe3..6c4755a3e1434c9ebccd4eac0e094682c3ea541c 100644 (file)
@@ -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"));
index 4360e5eab1eb7c77e543abe5a4a00678dafed260..b1d3ea299b51f7fcf84475df1fdc974ba8a58797 100644 (file)
@@ -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 (file)
index 0000000..e67ef0c
--- /dev/null
@@ -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);
+}