diff options
author | Dmitrii Maganov <vonagam@gmail.com> | 2022-12-05 20:24:11 +0200 |
---|---|---|
committer | Dmitrii Maganov <vonagam@gmail.com> | 2022-12-06 00:22:56 +0200 |
commit | 97280279ee45b628f9786548f6d7979836fd6ac5 (patch) | |
tree | bde548fa5d1ed4687e32a1d7e0dc5bbecaa60840 /modules/gdscript/tests/scripts/runtime/features/parameter_shadowing.gd | |
parent | f3e6750a7e4702918e05f42b1376e30e652f2f90 (diff) |
Fix incomplete shadowing of member properties by parameters
Diffstat (limited to 'modules/gdscript/tests/scripts/runtime/features/parameter_shadowing.gd')
-rw-r--r-- | modules/gdscript/tests/scripts/runtime/features/parameter_shadowing.gd | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/runtime/features/parameter_shadowing.gd b/modules/gdscript/tests/scripts/runtime/features/parameter_shadowing.gd new file mode 100644 index 0000000000..f33ba7dffd --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/parameter_shadowing.gd @@ -0,0 +1,25 @@ +# https://github.com/godotengine/godot/pull/69620 + +var a: int = 1 + +func shadow_regular_assignment(a: Variant, b: Variant) -> void: + print(a) + print(self.a) + a = b + print(a) + print(self.a) + + +var v := Vector2(0.0, 0.0) + +func shadow_subscript_assignment(v: Vector2, x: float) -> void: + print(v) + print(self.v) + v.x += x + print(v) + print(self.v) + + +func test(): + shadow_regular_assignment('a', 'b') + shadow_subscript_assignment(Vector2(1.0, 1.0), 5.0) |