mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
GDScript: Fix subscript resolution on constant non-metatype GDScript base
This commit is contained in:
@@ -25,12 +25,24 @@ func test():
|
||||
if str(property.name).begins_with("test_"):
|
||||
print(Utils.get_property_signature(property))
|
||||
|
||||
print("---")
|
||||
check_gdscript_native_class(test_native)
|
||||
check_gdscript(test_script)
|
||||
check_gdscript(test_class)
|
||||
check_enum(test_enum)
|
||||
|
||||
print("---")
|
||||
print(test_native.stringify([]))
|
||||
print(test_script.TEST)
|
||||
print(test_class.TEST)
|
||||
print(test_enum.keys())
|
||||
|
||||
print("---")
|
||||
# Some users add unnecessary type hints to `const`-`preload`, which removes metatypes.
|
||||
# For **constant** `GDScript` we still check the class members, despite the wider type.
|
||||
const ScriptNoMeta: GDScript = Other
|
||||
const ClassNoMeta: GDScript = MyClass
|
||||
var a := ScriptNoMeta.TEST
|
||||
var b := ClassNoMeta.TEST
|
||||
print(a)
|
||||
print(b)
|
||||
|
||||
@@ -3,11 +3,16 @@ var test_native: GDScriptNativeClass
|
||||
var test_script: GDScript
|
||||
var test_class: GDScript
|
||||
var test_enum: Dictionary
|
||||
---
|
||||
GDScriptNativeClass
|
||||
GDScript
|
||||
GDScript
|
||||
{ "A": 0, "B": 1, "C": 2 }
|
||||
---
|
||||
[]
|
||||
100
|
||||
10
|
||||
["A", "B", "C"]
|
||||
---
|
||||
100
|
||||
10
|
||||
|
||||
Reference in New Issue
Block a user