summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_analyzer.cpp
diff options
context:
space:
mode:
authorDmitrii Maganov <vonagam@gmail.com>2023-02-01 14:52:18 +0200
committerDmitrii Maganov <vonagam@gmail.com>2023-02-01 14:52:29 +0200
commit1a810ff45ebda061c2f41249eca1c8df9b5991e8 (patch)
tree00ad35ebff068aaca3c290183b01e33306c0bf9a /modules/gdscript/gdscript_analyzer.cpp
parent0a9e6e478e3183d7bf3c5cb895c706bc6275d3ea (diff)
downloadredot-engine-1a810ff45ebda061c2f41249eca1c8df9b5991e8.tar.gz
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 1c2b743909..77fc1a209d 100644
--- a/modules/gdscript/gdscript_analyzer.cpp
+++ b/modules/gdscript/gdscript_analyzer.cpp
@@ -3988,7 +3988,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);
@@ -3996,6 +3995,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);
}