From 8655d979a19bc2c295bd1c41c3fa0e9dba097a0c Mon Sep 17 00:00:00 2001 From: Dmitrii Maganov Date: Tue, 28 Mar 2023 13:47:24 +0300 Subject: GDScript: Allow elements of a parent class in a typed array literal --- modules/gdscript/gdscript_analyzer.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'modules/gdscript/gdscript_analyzer.cpp') diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index a2cab25ce8..3606a94c16 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -2373,6 +2373,10 @@ void GDScriptAnalyzer::update_array_literal_element_type(GDScriptParser::ArrayNo continue; } if (!is_type_compatible(p_element_type, element_type, true, p_array)) { + if (is_type_compatible(element_type, p_element_type)) { + mark_node_unsafe(element_node); + continue; + } push_error(vformat(R"(Cannot have an element of type "%s" in an array of type "Array[%s]".)", element_type.to_string(), p_element_type.to_string()), element_node); return; } -- cgit v1.2.3