summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-11-06 23:02:03 -0500
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-11-06 23:02:48 -0500
commitf7c57f83d686d6dfc01d82ccc0528be7ecfb331f (patch)
treeb58f7fb2d19633827b8920ec6e86602207418702 /tests
parente466dde8a720fe8c9653aed200190dcfeb0d640e (diff)
Don't include package for union selector completions if the package has being 'using'ed
Diffstat (limited to 'tests')
-rw-r--r--tests/completions_test.odin36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/completions_test.odin b/tests/completions_test.odin
index 0f9aded..43f4984 100644
--- a/tests/completions_test.odin
+++ b/tests/completions_test.odin
@@ -5028,3 +5028,39 @@ ast_completion_empty_selector_for_init :: proc(t: ^testing.T) {
}
test.expect_completion_docs(t, &source, "", {"Foo.bars: [5]int"})
}
+
+@(test)
+ast_completion_union_option_with_using :: proc(t: ^testing.T) {
+ packages := make([dynamic]test.Package, context.temp_allocator)
+
+ append(
+ &packages,
+ test.Package {
+ pkg = "my_package",
+ source = `package my_package
+ Foo :: struct{}
+
+ Bar :: struct{}
+
+ Bazz :: union {
+ ^Foo,
+ ^Bar,
+ }
+ `,
+ },
+ )
+ source := test.Source {
+ main = `package test
+ import "my_package"
+
+ main :: proc() {
+ using my_package
+
+ bazz: Bazz
+ if foo, ok := bazz.{*}
+ }
+ `,
+ packages = packages[:],
+ }
+ test.expect_completion_labels(t, &source, "", {"(^Foo)", "(^Bar)"})
+}