-
Notifications
You must be signed in to change notification settings - Fork 39
Weird behaviour with setters calling associated getter #1002
Open
Labels
Description
Example 1 (associated getter):
Test: class { value: Int { get { return 2 } set (x) { if (this value == 2) "two" println() else "not two, but: %i" printfln(this value) } } init: func } x := Test new() x value = 10
should print "two" but prints "not two, but: 0".
Example 2 (setter calling itself):
Same here. But:
Test: class { value: Int { get { return 2 } set (x) { "old value=%i" printfln(this value) this value = x } } init: func } x := Test new() x value = 2 x value = 3 x value = 4
should always print "old value=2" but prints
old value=0
old value=2
old value=3