summaryrefslogtreecommitdiff
path: root/modules/gdscript/tests/scripts/analyzer/features
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-02-20 15:41:45 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-02-20 15:41:45 +0100
commit2057d7344ee60fc58d7f09ff742dea1850291d21 (patch)
treec80dfa68a6d7d9718b64970a171c0769aa27fed9 /modules/gdscript/tests/scripts/analyzer/features
parentea2bc9795c46ebb705c72add7a30ffeb59ff7922 (diff)
parent75f16b8167fe23d06983d92a9bb66701cf0a0f7a (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.gd30
-rw-r--r--modules/gdscript/tests/scripts/analyzer/features/global_enums.out9
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