[vala] codegen: Property equality check can't be applied to non-automatic-bodies
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] codegen: Property equality check can't be applied to non-automatic-bodies
- Date: Sun, 12 Mar 2017 21:40:29 +0000 (UTC)
commit 04489bc5ee34edfa2024f910a81c24bc9308c191
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sun Mar 12 22:33:34 2017 +0100
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
codegen/valaccodebasemodule.vala | 2 +-
tests/Makefile.am | 1 +
tests/objects/bug779955.vala | 20 ++++++++++++++++++++
3 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 3a68264..6c4755a 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 4360e5e..b1d3ea2 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 0000000..e67ef0c
--- /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);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]