diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-05-15 13:46:54 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-05-15 13:46:54 +0200 |
commit | 5adac3c6807c4414bc9629054f340a9da773d2cb (patch) | |
tree | cbf71b6dad5889451a7aa08a897ccef16ab08422 /modules/gdscript/gdscript_analyzer.cpp | |
parent | b497729c925d5b869f35e854e8d599ce436ca2a7 (diff) | |
parent | 7da3110e6b7ad1a1b365eac75bcc71eeb0edd7f9 (diff) | |
download | redot-engine-5adac3c6807c4414bc9629054f340a9da773d2cb.tar.gz |
Merge pull request #77091 from dalexeev/gds-fix-validate-call-arg
GDScript: Fix `validate_call_arg()` for unresolved datatype
Diffstat (limited to 'modules/gdscript/gdscript_analyzer.cpp')
-rw-r--r-- | modules/gdscript/gdscript_analyzer.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index 9092ae2969..96bd8aafad 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -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); |