summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_analyzer.cpp
diff options
context:
space:
mode:
authorYuri Sizov <11782833+YuriSizov@users.noreply.github.com>2023-02-06 19:41:27 +0300
committerGitHub <noreply@github.com>2023-02-06 19:41:27 +0300
commitd201df1ffa75bd37dc394461ae8fd03e4342c344 (patch)
tree7b32360840991ef966bc97ab04b4184688644a0e /modules/gdscript/gdscript_analyzer.cpp
parent8a37fad281f369d152fd0748875b05d58076e006 (diff)
parent1a810ff45ebda061c2f41249eca1c8df9b5991e8 (diff)
downloadredot-engine-d201df1ffa75bd37dc394461ae8fd03e4342c344.tar.gz
Merge pull request #72512 from vonagam/fix-ternary-type-source
GDScript: Fix type certainty for result of ternary operator
Diffstat (limited to 'modules/gdscript/gdscript_analyzer.cpp')
-rw-r--r--modules/gdscript/gdscript_analyzer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp
index e84c79d681..cafc7328e0 100644
--- a/modules/gdscript/gdscript_analyzer.cpp
+++ b/modules/gdscript/gdscript_analyzer.cpp
@@ -4113,7 +4113,6 @@ void GDScriptAnalyzer::reduce_ternary_op(GDScriptParser::TernaryOpNode *p_ternar
if (!is_type_compatible(true_type, false_type)) {
result = false_type;
if (!is_type_compatible(false_type, true_type)) {
- result.type_source = GDScriptParser::DataType::UNDETECTED;
result.kind = GDScriptParser::DataType::VARIANT;
#ifdef DEBUG_ENABLED
parser->push_warning(p_ternary_op, GDScriptWarning::INCOMPATIBLE_TERNARY);
@@ -4121,6 +4120,7 @@ void GDScriptAnalyzer::reduce_ternary_op(GDScriptParser::TernaryOpNode *p_ternar
}
}
}
+ result.type_source = true_type.is_hard_type() && false_type.is_hard_type() ? GDScriptParser::DataType::ANNOTATED_INFERRED : GDScriptParser::DataType::INFERRED;
p_ternary_op->set_datatype(result);
}