-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94674 from dalexeev/gds-fix-incorrect-setter-call…
…-for-ref-types GDScript: Fix incorrect setter call for reference types
- Loading branch information
Showing
3 changed files
with
97 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
modules/gdscript/tests/scripts/runtime/features/setter_chain_shared_types.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# GH-94667 | ||
|
||
class Inner: | ||
var subprop: Vector2: | ||
set(value): | ||
prints("subprop setter", value) | ||
subprop = value | ||
get: | ||
print("subprop getter") | ||
return subprop | ||
|
||
func _to_string() -> String: | ||
return "<Inner>" | ||
|
||
var prop1: | ||
set(value): | ||
prints("prop1 setter", value) | ||
prop1 = value | ||
|
||
var prop2: Inner: | ||
set(value): | ||
prints("prop2 setter", value) | ||
prop2 = value | ||
|
||
var prop3: | ||
set(value): | ||
prints("prop3 setter", value) | ||
prop3 = value | ||
get: | ||
print("prop3 getter") | ||
return prop3 | ||
|
||
var prop4: Inner: | ||
set(value): | ||
prints("prop4 setter", value) | ||
prop4 = value | ||
get: | ||
print("prop4 getter") | ||
return prop4 | ||
|
||
func test(): | ||
print("===") | ||
prop1 = Vector2() | ||
prop1.x = 1.0 | ||
print("---") | ||
prop1 = Inner.new() | ||
prop1.subprop.x = 1.0 | ||
|
||
print("===") | ||
prop2 = Inner.new() | ||
prop2.subprop.x = 1.0 | ||
|
||
print("===") | ||
prop3 = Vector2() | ||
prop3.x = 1.0 | ||
print("---") | ||
prop3 = Inner.new() | ||
prop3.subprop.x = 1.0 | ||
|
||
print("===") | ||
prop4 = Inner.new() | ||
prop4.subprop.x = 1.0 |
26 changes: 26 additions & 0 deletions
26
modules/gdscript/tests/scripts/runtime/features/setter_chain_shared_types.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
GDTEST_OK | ||
=== | ||
prop1 setter (0, 0) | ||
prop1 setter (1, 0) | ||
--- | ||
prop1 setter <Inner> | ||
subprop getter | ||
subprop setter (1, 0) | ||
=== | ||
prop2 setter <Inner> | ||
subprop getter | ||
subprop setter (1, 0) | ||
=== | ||
prop3 setter (0, 0) | ||
prop3 getter | ||
prop3 setter (1, 0) | ||
--- | ||
prop3 setter <Inner> | ||
prop3 getter | ||
subprop getter | ||
subprop setter (1, 0) | ||
=== | ||
prop4 setter <Inner> | ||
prop4 getter | ||
subprop getter | ||
subprop setter (1, 0) |