Browse Source

Merge pull request #53720 from vnen/gdscript-typed-array-custom-class

Rémi Verschelde 3 years ago
parent
commit
e4288bf728

+ 1 - 0
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);
 			}
 		}

+ 10 - 0
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)

+ 2 - 0
modules/gdscript/tests/scripts/analyzer/features/typed_array_with_custom_class.out

@@ -0,0 +1,2 @@
+GDTEST_OK
+Inner