GDScript: Make setter parameter type same as variable type
This commit is contained in:
parent
b67e68bce3
commit
45f546c1d8
@ -893,11 +893,13 @@ void GDScriptAnalyzer::resolve_class_body(GDScriptParser::ClassNode *p_class) {
|
|||||||
resolve_function_body(member.variable->getter);
|
resolve_function_body(member.variable->getter);
|
||||||
}
|
}
|
||||||
if (member.variable->setter != nullptr) {
|
if (member.variable->setter != nullptr) {
|
||||||
|
resolve_function_signature(member.variable->setter);
|
||||||
|
|
||||||
if (member.variable->setter->parameters.size() > 0) {
|
if (member.variable->setter->parameters.size() > 0) {
|
||||||
member.variable->setter->parameters[0]->datatype_specifier = member.variable->datatype_specifier;
|
member.variable->setter->parameters[0]->datatype_specifier = member.variable->datatype_specifier;
|
||||||
|
member.variable->setter->parameters[0]->set_datatype(member.get_datatype());
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve_function_signature(member.variable->setter);
|
|
||||||
resolve_function_body(member.variable->setter);
|
resolve_function_body(member.variable->setter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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)
|
@ -0,0 +1,2 @@
|
|||||||
|
GDTEST_ANALYZER_ERROR
|
||||||
|
Value of type "int" cannot be assigned to a variable of type "String".
|
Loading…
Reference in New Issue
Block a user