Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GDScript: Fix unresolved datatype for incomplete expressions #83257

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions modules/gdscript/gdscript_analyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2500,6 +2500,14 @@ void GDScriptAnalyzer::reduce_expression(GDScriptParser::ExpressionNode *p_expre
case GDScriptParser::Node::WHILE:
ERR_FAIL_MSG("Reaching unreachable case");
}

if (p_expression->get_datatype().kind == GDScriptParser::DataType::UNRESOLVED) {
// Prevent `is_type_compatible()` errors for incomplete expressions.
// The error can still occur if `reduce_*()` is called directly.
GDScriptParser::DataType dummy;
dummy.kind = GDScriptParser::DataType::VARIANT;
p_expression->set_datatype(dummy);
}
}

void GDScriptAnalyzer::reduce_array(GDScriptParser::ArrayNode *p_array) {
Expand Down Expand Up @@ -2802,9 +2810,6 @@ void GDScriptAnalyzer::reduce_binary_op(GDScriptParser::BinaryOpNode *p_binary_o
}

if (!left_type.is_set() || !right_type.is_set()) {
GDScriptParser::DataType dummy;
dummy.kind = GDScriptParser::DataType::VARIANT;
p_binary_op->set_datatype(dummy);
return;
}

Expand Down