diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-10-12 16:51:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-12 16:51:50 +0200 |
commit | e4288bf7283376adc274860744203faad34d83ec (patch) | |
tree | 5e2a1c10ea5ca668c89d1a23cbff61ec882119e0 | |
parent | cb85ef6c38ec77041593ea89ba544d9cf74cf2a6 (diff) | |
parent | 34288b24a6d43d0f9a314f4aaccbebe454f9f23e (diff) |
Merge pull request #53720 from vnen/gdscript-typed-array-custom-class
3 files changed, 13 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index 9e9873d45f..8bd288cf0f 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -470,6 +470,7 @@ GDScriptParser::DataType GDScriptAnalyzer::resolve_datatype(GDScriptParser::Type GDScriptParser::DataType container_type = resolve_datatype(p_type->container_type); if (container_type.kind != GDScriptParser::DataType::VARIANT) { + container_type.is_meta_type = false; result.set_container_element_type(container_type); } } diff --git a/modules/gdscript/tests/scripts/analyzer/features/typed_array_with_custom_class.gd b/modules/gdscript/tests/scripts/analyzer/features/typed_array_with_custom_class.gd new file mode 100644 index 0000000000..9502f6e196 --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/typed_array_with_custom_class.gd @@ -0,0 +1,10 @@ +class Inner: + var prop = "Inner" + + +var array: Array[Inner] = [Inner.new()] + + +func test(): + var element: Inner = array[0] + print(element.prop) diff --git a/modules/gdscript/tests/scripts/analyzer/features/typed_array_with_custom_class.out b/modules/gdscript/tests/scripts/analyzer/features/typed_array_with_custom_class.out new file mode 100644 index 0000000000..8f250d2632 --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/typed_array_with_custom_class.out @@ -0,0 +1,2 @@ +GDTEST_OK +Inner |