Merge pull request #58185 from V-Sekai/explicit_variant_assignment_fix

This commit is contained in:
Rémi Verschelde 2022-03-04 14:56:38 +01:00 committed by GitHub
commit bb8c4acdc9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1424,7 +1424,7 @@ void GDScriptAnalyzer::resolve_variable(GDScriptParser::VariableNode *p_variable
parser->push_warning(p_variable->initializer, GDScriptWarning::NARROWING_CONVERSION);
#endif
}
if (p_variable->initializer->get_datatype().is_variant()) {
if (p_variable->initializer->get_datatype().is_variant() && !type.is_variant()) {
// TODO: Warn unsafe assign.
mark_node_unsafe(p_variable->initializer);
p_variable->use_conversion_assign = true;