GDScript: Fix UNSAFE_CAST warning

This commit is contained in:
Danil Alexeev 2023-10-27 11:08:54 +03:00
parent 09946f79bd
commit 6e996a597f
No known key found for this signature in database
GPG key ID: 124453E157DA8DC7
22 changed files with 150 additions and 6 deletions

View file

@ -3453,9 +3453,7 @@ void GDScriptAnalyzer::reduce_cast(GDScriptParser::CastNode *p_cast) {
if (op_type.is_variant() || !op_type.is_hard_type()) {
mark_node_unsafe(p_cast);
#ifdef DEBUG_ENABLED
if (op_type.is_variant() && !op_type.is_hard_type()) {
parser->push_warning(p_cast, GDScriptWarning::UNSAFE_CAST, cast_type.to_string());
}
parser->push_warning(p_cast, GDScriptWarning::UNSAFE_CAST, cast_type.to_string());
#endif
} else {
bool valid = false;