summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-09-15 15:50:42 +0200
committerGitHub <noreply@github.com>2021-09-15 15:50:42 +0200
commitc23823ac54059d4da74af737b3440b0eb58a6d4e (patch)
tree43f7d1674a599bed8f63f76ad8a048f92626b9b3
parentb22b6ea8087219805ce899f6f1d7d37869fb640f (diff)
parentb9219bedf73ad933a5b93de5c09d86ed58977c18 (diff)
Merge pull request #52582 from jmb462/Prevent-non-explicit-inferring-parameter-from-null
-rw-r--r--modules/gdscript/gdscript_analyzer.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp
index 06db46173c..e3639cf6fb 100644
--- a/modules/gdscript/gdscript_analyzer.cpp
+++ b/modules/gdscript/gdscript_analyzer.cpp
@@ -1490,6 +1490,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);
}