aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-06 20:47:27 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-06 20:48:31 -0400
commit4a78b4ad1dca9a1218c4df2d97bfb5d9465bc063 (patch)
tree3eea76835d1180692492190988999c753434ac43 /tests
parentd4b195cf6dba5894f9597c935106d190860d9de8 (diff)
Correctly filter used unions when ptr
Diffstat (limited to 'tests')
-rw-r--r--tests/completions_test.odin27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/completions_test.odin b/tests/completions_test.odin
index f8bb410..41f0566 100644
--- a/tests/completions_test.odin
+++ b/tests/completions_test.odin
@@ -3780,3 +3780,30 @@ ast_completion_union_switch_remove_used_cases :: proc(t: ^testing.T) {
test.expect_completion_details(t, &source, "", {"Foo2", "Foo3"}, {"Foo1"})
}
+
+@(test)
+ast_completion_union_switch_remove_used_cases_ptr :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ Foo1 :: struct{}
+ Foo2 :: struct{}
+ Foo3 :: struct{}
+ Foo :: union {
+ ^Foo1,
+ ^Foo2,
+ ^Foo3,
+ }
+
+ main :: proc() {
+ foo: Foo
+
+ switch v in Foo {
+ case ^Foo1:
+ case F{*}
+ }
+ }
+ `,
+ }
+
+ test.expect_completion_details(t, &source, "", {"^Foo2", "^Foo3"}, {"^Foo1"})
+}