Merge pull request #52582 from jmb462/Prevent-non-explicit-inferring-parameter-from-null

This commit is contained in:
Rémi Verschelde 2021-09-15 15:50:42 +02:00 committed by GitHub
commit c23823ac54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);
}