aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-11-06 05:15:13 -0500
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-11-06 05:15:13 -0500
commit0b7271488d9f339f0be3a0f7ccb81dd2d5dfb7df (patch)
tree39cb7ca9b1fceffc8fd9758c3992e038f372d053 /tests
parent10ea97356964e04bfe522a8ad276528bdac35d48 (diff)
Resolve implicit selector switch statements before index expressions
Diffstat (limited to 'tests')
-rw-r--r--tests/references_test.odin40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/references_test.odin b/tests/references_test.odin
index d0d99f1..021033b 100644
--- a/tests/references_test.odin
+++ b/tests/references_test.odin
@@ -1480,3 +1480,43 @@ ast_references_union_member_pointer :: proc(t: ^testing.T) {
test.expect_reference_locations(t, &source, locations[:])
}
+
+@(test)
+ast_references_enum_with_enumerated_array :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+
+ Foo :: enum {
+ A, B,
+ }
+
+ Bar :: enum {
+ C, D,
+ }
+
+ Bazz :: struct {
+ foobars: [Bar]Foo
+ }
+
+ main :: proc() {
+ bazz: Bazz
+ bar: Bar
+
+ foo: Foo
+ foo = .A{*}
+
+ switch bazz.foobars[bar] {
+ case .A:
+ case .B:
+ }
+ }
+ `,
+ }
+ locations := []common.Location {
+ {range = {start = {line = 3, character = 4}, end = {line = 3, character = 5}}},
+ {range = {start = {line = 19, character = 11}, end = {line = 19, character = 12}}},
+ {range = {start = {line = 22, character = 10}, end = {line = 22, character = 11}}},
+ }
+
+ test.expect_reference_locations(t, &source, locations[:])
+}