Skip to content

Commit

Permalink
Merge pull request #77091 from dalexeev/gds-fix-validate-call-arg
Browse files Browse the repository at this point in the history
GDScript: Fix `validate_call_arg()` for unresolved datatype
  • Loading branch information
akien-mga committed May 15, 2023
2 parents b497729 + 7da3110 commit 5adac3c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions modules/gdscript/gdscript_analyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5adac3c

Please sign in to comment.