From b6aa4840d827f2679d5f21591cc41222a96385bf Mon Sep 17 00:00:00 2001 From: Dmitrii Maganov Date: Tue, 27 Dec 2022 05:06:11 +0200 Subject: Fix usage of Enum as constant --- .../scripts/analyzer/features/enum_as_const.gd | 29 ++++++++++++++++++++++ .../scripts/analyzer/features/enum_as_const.out | 17 +++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 modules/gdscript/tests/scripts/analyzer/features/enum_as_const.gd create mode 100644 modules/gdscript/tests/scripts/analyzer/features/enum_as_const.out (limited to 'modules/gdscript/tests/scripts/analyzer') diff --git a/modules/gdscript/tests/scripts/analyzer/features/enum_as_const.gd b/modules/gdscript/tests/scripts/analyzer/features/enum_as_const.gd new file mode 100644 index 0000000000..2ce588373b --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/enum_as_const.gd @@ -0,0 +1,29 @@ +class Outer: + enum OuterEnum { OuterValue = 3 } + const OuterConst := OuterEnum + + class Inner: + enum InnerEnum { InnerValue = 7 } + const InnerConst := InnerEnum + + static func test() -> void: + print(OuterEnum.size()); + print(OuterEnum.OuterValue); + print(OuterConst.size()); + print(OuterConst.OuterValue); + print(Outer.OuterEnum.size()); + print(Outer.OuterEnum.OuterValue); + print(Outer.OuterConst.size()); + print(Outer.OuterConst.OuterValue); + + print(InnerEnum.size()); + print(InnerEnum.InnerValue); + print(InnerConst.size()); + print(InnerConst.InnerValue); + print(Inner.InnerEnum.size()); + print(Inner.InnerEnum.InnerValue); + print(Inner.InnerConst.size()); + print(Inner.InnerConst.InnerValue); + +func test(): + Outer.Inner.test() diff --git a/modules/gdscript/tests/scripts/analyzer/features/enum_as_const.out b/modules/gdscript/tests/scripts/analyzer/features/enum_as_const.out new file mode 100644 index 0000000000..e049f85b6e --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/enum_as_const.out @@ -0,0 +1,17 @@ +GDTEST_OK +1 +3 +1 +3 +1 +3 +1 +3 +1 +7 +1 +7 +1 +7 +1 +7 -- cgit v1.2.3