summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_analyzer.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-06-14 09:23:32 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-06-14 09:23:32 +0200
commit8b62c52d1cf1bd38fdd379eeb8dd91644a42a70e (patch)
tree0accfaabd2f273470a3f03acbdf6e7aa815d121b /modules/gdscript/gdscript_analyzer.cpp
parent0ebd2aea4576c2b15a15b2fde489e9124c69d3ff (diff)
parent8655d979a19bc2c295bd1c41c3fa0e9dba097a0c (diff)
downloadredot-engine-8b62c52d1cf1bd38fdd379eeb8dd91644a42a70e.tar.gz
Merge pull request #75419 from vonagam/fix-super-classes-in-array-literals
GDScript: Allow elements of a parent class in a typed array literal
Diffstat (limited to 'modules/gdscript/gdscript_analyzer.cpp')
-rw-r--r--modules/gdscript/gdscript_analyzer.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp
index 029676e404..13fd115c43 100644
--- a/modules/gdscript/gdscript_analyzer.cpp
+++ b/modules/gdscript/gdscript_analyzer.cpp
@@ -2446,6 +2446,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;
}