diff options
author | jmb462 <jmb462@gmail.com> | 2021-09-11 21:05:44 +0200 |
---|---|---|
committer | jmb462 <jmb462@gmail.com> | 2021-09-11 21:11:10 +0200 |
commit | b9219bedf73ad933a5b93de5c09d86ed58977c18 (patch) | |
tree | e7ebc55cb76251e29f8610c88eb851489a3eabf1 | |
parent | 9d629fa7fb9f3d69395ba49d6fb80186f8d6a789 (diff) |
Prevent non explicit inferring parameter from null
-rw-r--r-- | modules/gdscript/gdscript_analyzer.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index fc0bef3ba2..8175738c0e 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -1478,6 +1478,10 @@ void GDScriptAnalyzer::resolve_parameter(GDScriptParser::ParameterNode *p_parame } } + if (result.builtin_type == Variant::Type::NIL && result.type_source == GDScriptParser::DataType::ANNOTATED_INFERRED && p_parameter->datatype_specifier == nullptr) { + push_error(vformat(R"(Could not infer the type of the variable "%s" because the initial value is "null".)", p_parameter->identifier->name), p_parameter->default_value); + } + p_parameter->set_datatype(result); } |