From 7ee011051ace34a5d2091ceda9b3e178283824a2 Mon Sep 17 00:00:00 2001 From: Dmitrii Maganov Date: Thu, 23 Feb 2023 03:25:26 +0200 Subject: GDScript: Fix usage of enum value as range argument --- .../tests/scripts/analyzer/features/enums_in_range_call.gd | 9 +++++++++ .../tests/scripts/analyzer/features/enums_in_range_call.out | 2 ++ 2 files changed, 11 insertions(+) create mode 100644 modules/gdscript/tests/scripts/analyzer/features/enums_in_range_call.gd create mode 100644 modules/gdscript/tests/scripts/analyzer/features/enums_in_range_call.out (limited to 'modules/gdscript/tests') diff --git a/modules/gdscript/tests/scripts/analyzer/features/enums_in_range_call.gd b/modules/gdscript/tests/scripts/analyzer/features/enums_in_range_call.gd new file mode 100644 index 0000000000..d2d9d04508 --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/enums_in_range_call.gd @@ -0,0 +1,9 @@ +enum E { E0 = 0, E3 = 3 } + +func test(): + var total := 0 + for value in range(E.E0, E.E3): + var inferable := value + total += inferable + assert(total == 0 + 1 + 2) + print('ok') diff --git a/modules/gdscript/tests/scripts/analyzer/features/enums_in_range_call.out b/modules/gdscript/tests/scripts/analyzer/features/enums_in_range_call.out new file mode 100644 index 0000000000..1b47ed10dc --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/enums_in_range_call.out @@ -0,0 +1,2 @@ +GDTEST_OK +ok -- cgit v1.2.3