diff options
author | George Marques <george@gmarqu.es> | 2020-08-18 13:12:18 -0300 |
---|---|---|
committer | George Marques <george@gmarqu.es> | 2020-08-18 13:12:18 -0300 |
commit | 8bc9b3a2ae7e15828825c81960c9c422aaddcf36 (patch) | |
tree | 34ac0bd5809814a905e2a0f80bf121c835bd152d /modules/gdscript/gdscript_analyzer.cpp | |
parent | 8088e9e6acb3d8cec00610e9345596bbabed6923 (diff) | |
download | redot-engine-8bc9b3a2ae7e15828825c81960c9c422aaddcf36.tar.gz |
GDScript: Allow implicit type conversion when constructing variants
Incidentally fix error message when no valid constructor is found which
was missing an end parenthesis.
Diffstat (limited to 'modules/gdscript/gdscript_analyzer.cpp')
-rw-r--r-- | modules/gdscript/gdscript_analyzer.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index 0768dd05e5..881c40a4c6 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -1634,6 +1634,7 @@ void GDScriptAnalyzer::reduce_call(GDScriptParser::CallNode *p_call, bool is_awa } signature += p_call->arguments[i]->get_datatype().to_string(); } + signature += ")"; push_error(vformat(R"(No constructor of "%s" matches the signature "%s".)", Variant::get_type_name(builtin_type), signature), p_call->callee); } break; case Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS: @@ -1684,7 +1685,7 @@ void GDScriptAnalyzer::reduce_call(GDScriptParser::CallNode *p_call, bool is_awa for (int i = 0; i < p_call->arguments.size(); i++) { GDScriptParser::DataType par_type = type_from_property(info.arguments[i]); - if (!is_type_compatible(par_type, p_call->arguments[i]->get_datatype())) { + if (!is_type_compatible(par_type, p_call->arguments[i]->get_datatype(), true)) { types_match = false; break; #ifdef DEBUG_ENABLED @@ -1711,6 +1712,7 @@ void GDScriptAnalyzer::reduce_call(GDScriptParser::CallNode *p_call, bool is_awa } signature += p_call->arguments[i]->get_datatype().to_string(); } + signature += ")"; push_error(vformat(R"(No constructor of "%s" matches the signature "%s".)", Variant::get_type_name(builtin_type), signature), p_call); } } |