GDScript: Fix subscript resolution on constant non-metatype GDScript base
This commit is contained in:
parent
25519867f2
commit
18d8838051
3 changed files with 56 additions and 7 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue