From 45f546c1d8d692e76c4e00d2d38518b968787916 Mon Sep 17 00:00:00 2001 From: George Marques Date: Tue, 12 Oct 2021 09:39:23 -0300 Subject: GDScript: Make setter parameter type same as variable type --- .../analyzer/errors/setter_parameter_uses_property_type.gd | 8 ++++++++ .../analyzer/errors/setter_parameter_uses_property_type.out | 2 ++ 2 files changed, 10 insertions(+) create mode 100644 modules/gdscript/tests/scripts/analyzer/errors/setter_parameter_uses_property_type.gd create mode 100644 modules/gdscript/tests/scripts/analyzer/errors/setter_parameter_uses_property_type.out (limited to 'modules/gdscript/tests/scripts/analyzer') diff --git a/modules/gdscript/tests/scripts/analyzer/errors/setter_parameter_uses_property_type.gd b/modules/gdscript/tests/scripts/analyzer/errors/setter_parameter_uses_property_type.gd new file mode 100644 index 0000000000..3bbee5f5f7 --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/errors/setter_parameter_uses_property_type.gd @@ -0,0 +1,8 @@ +var with_setter := 0: + set(val): + var x: String = val + with_setter = val + +func test(): + with_setter = 1 + print(with_setter) diff --git a/modules/gdscript/tests/scripts/analyzer/errors/setter_parameter_uses_property_type.out b/modules/gdscript/tests/scripts/analyzer/errors/setter_parameter_uses_property_type.out new file mode 100644 index 0000000000..9eb2a42ccd --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/errors/setter_parameter_uses_property_type.out @@ -0,0 +1,2 @@ +GDTEST_ANALYZER_ERROR +Value of type "int" cannot be assigned to a variable of type "String". -- cgit v1.2.3