GDScript: Preserve compatibility for untyped return of _get_property_list()

This commit is contained in:
Danil Alexeev
2026-05-04 11:38:49 +03:00
parent 16bb065ac3
commit 30f2a30f9b
8 changed files with 125 additions and 3 deletions
+14
View File
@@ -1876,7 +1876,21 @@ void GDScriptAnalyzer::resolve_function_signature(GDScriptParser::FunctionNode *
bool valid = p_function->is_static == method_flags.has_flag(METHOD_FLAG_STATIC);
if (p_function->return_type == nullptr) {
// GH-118877. We decided to make an exception to maintain compatibility, since the problem can only be detected at runtime.
#ifdef DISABLE_DEPRECATED
p_function->set_datatype(parent_return_type);
#else // !DISABLE_DEPRECATED
if (function_name == GDScriptLanguage::get_singleton()->strings._get_property_list && method_flags.has_flag(METHOD_FLAG_VIRTUAL)) {
GDScriptParser::DataType array_type;
array_type.type_source = GDScriptParser::DataType::ANNOTATED_INFERRED;
array_type.kind = GDScriptParser::DataType::BUILTIN;
array_type.builtin_type = Variant::ARRAY;
p_function->set_datatype(array_type);
} else {
p_function->set_datatype(parent_return_type);
}
#endif // DISABLE_DEPRECATED
} else {
// Check return type covariance.
GDScriptParser::DataType return_type = p_function->get_datatype();