diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-20 15:41:45 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-20 15:41:45 +0100 |
commit | 2057d7344ee60fc58d7f09ff742dea1850291d21 (patch) | |
tree | c80dfa68a6d7d9718b64970a171c0769aa27fed9 /modules/gdscript/tests/scripts/analyzer/features | |
parent | ea2bc9795c46ebb705c72add7a30ffeb59ff7922 (diff) | |
parent | 75f16b8167fe23d06983d92a9bb66701cf0a0f7a (diff) |
Merge pull request #73590 from vnen/gdscript-global-scope-enums
Make global scope enums accessible as types in GDScript
Diffstat (limited to 'modules/gdscript/tests/scripts/analyzer/features')
-rw-r--r-- | modules/gdscript/tests/scripts/analyzer/features/global_enums.gd | 30 | ||||
-rw-r--r-- | modules/gdscript/tests/scripts/analyzer/features/global_enums.out | 9 |
2 files changed, 39 insertions, 0 deletions
diff --git a/modules/gdscript/tests/scripts/analyzer/features/global_enums.gd b/modules/gdscript/tests/scripts/analyzer/features/global_enums.gd new file mode 100644 index 0000000000..67d48817e8 --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/global_enums.gd @@ -0,0 +1,30 @@ +func test(): + var type: Variant.Type + type = Variant.Type.TYPE_INT + print(type) + type = TYPE_FLOAT + print(type) + + var direction: ClockDirection + direction = ClockDirection.CLOCKWISE + print(direction) + direction = COUNTERCLOCKWISE + print(direction) + + var duper := Duper.new() + duper.set_type(Variant.Type.TYPE_INT) + duper.set_type(TYPE_FLOAT) + duper.set_direction(ClockDirection.CLOCKWISE) + duper.set_direction(COUNTERCLOCKWISE) + +class Super: + func set_type(type: Variant.Type) -> void: + print(type) + func set_direction(dir: ClockDirection) -> void: + print(dir) + +class Duper extends Super: + func set_type(type: Variant.Type) -> void: + print(type) + func set_direction(dir: ClockDirection) -> void: + print(dir) diff --git a/modules/gdscript/tests/scripts/analyzer/features/global_enums.out b/modules/gdscript/tests/scripts/analyzer/features/global_enums.out new file mode 100644 index 0000000000..b3b5bf57c1 --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/global_enums.out @@ -0,0 +1,9 @@ +GDTEST_OK +2 +3 +0 +1 +2 +3 +0 +1 |