GDScript: Fix return type checking for inferred function type

This commit is contained in:
Danil Alexeev 2026-03-07 12:52:31 +03:00
parent fe6f78a4c7
commit 566d86d081
No known key found for this signature in database
GPG key ID: 5A52F75A8679EC57

View file

@ -2569,7 +2569,7 @@ void GDScriptAnalyzer::resolve_return(GDScriptParser::ReturnNode *p_return) {
result.is_constant = true;
}
if (has_expected_type && !expected_type.is_variant()) {
if (has_expected_type && !expected_type.is_variant() && expected_type.is_hard_type()) {
if (result.is_variant() || !result.is_hard_type()) {
mark_node_unsafe(p_return);
if (!is_type_compatible(expected_type, result, true, p_return)) {