summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_analyzer.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-04-28 18:45:00 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-04-28 18:45:00 +0200
commitf374390fc18363bb8be6b45997639254bd599ca2 (patch)
tree33c3629d7a1771c69bfa2355fb1e33f8fff273f4 /modules/gdscript/gdscript_analyzer.cpp
parente8f5d0f6e8867902874f663b3dbf339a7fe61b45 (diff)
parent5d0b183822052e894c98d8d0ea997e0afddc93ed (diff)
downloadredot-engine-f374390fc18363bb8be6b45997639254bd599ca2.tar.gz
Merge pull request #75014 from vonagam/assert-literal-false
GDScript: Allow usage of literal false in assert without a warning
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 46edc0431d..3c6b726808 100644
--- a/modules/gdscript/gdscript_analyzer.cpp
+++ b/modules/gdscript/gdscript_analyzer.cpp
@@ -2071,7 +2071,7 @@ void GDScriptAnalyzer::resolve_assert(GDScriptParser::AssertNode *p_assert) {
if (p_assert->condition->is_constant) {
if (p_assert->condition->reduced_value.booleanize()) {
parser->push_warning(p_assert->condition, GDScriptWarning::ASSERT_ALWAYS_TRUE);
- } else {
+ } else if (!(p_assert->condition->type == GDScriptParser::Node::LITERAL && static_cast<GDScriptParser::LiteralNode *>(p_assert->condition)->value.get_type() == Variant::BOOL)) {
parser->push_warning(p_assert->condition, GDScriptWarning::ASSERT_ALWAYS_FALSE);
}
}