GDScript: Fix `validate_call_arg()` for unresolved datatype

This commit is contained in:
Danil Alexeev 2023-05-15 11:17:53 +03:00
parent fb10f45efe
commit 7da3110e6b
No known key found for this signature in database
GPG Key ID: 124453E157DA8DC7
1 changed files with 5 additions and 3 deletions

View File

@ -4837,9 +4837,11 @@ void GDScriptAnalyzer::validate_call_arg(const List<GDScriptParser::DataType> &p
}
GDScriptParser::DataType arg_type = p_call->arguments[i]->get_datatype();
if ((arg_type.is_variant() || !arg_type.is_hard_type()) && !(par_type.is_hard_type() && par_type.is_variant())) {
// Argument can be anything, so this is unsafe.
mark_node_unsafe(p_call->arguments[i]);
if (arg_type.is_variant() || !arg_type.is_hard_type()) {
// Argument can be anything, so this is unsafe (unless the parameter is a hard variant).
if (!(par_type.is_hard_type() && par_type.is_variant())) {
mark_node_unsafe(p_call->arguments[i]);
}
} else if (par_type.is_hard_type() && !is_type_compatible(par_type, arg_type, true)) {
// Supertypes are acceptable for dynamic compliance, but it's unsafe.
mark_node_unsafe(p_call);