From f014cbc3ab5d6c0165c4728c1d89f87ea18274e1 Mon Sep 17 00:00:00 2001 From: Brad Lewis <22850972+BradLewis@users.noreply.github.com> Date: Thu, 6 Nov 2025 17:07:18 -0500 Subject: Reintroduce fallback code for selector exprs --- tests/completions_test.odin | 77 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) (limited to 'tests') diff --git a/tests/completions_test.odin b/tests/completions_test.odin index 557a14a..0f9aded 100644 --- a/tests/completions_test.odin +++ b/tests/completions_test.odin @@ -4951,3 +4951,80 @@ ast_completion_selector_after_selector_call_expr :: proc(t: ^testing.T) { } test.expect_completion_docs(t, &source, "", {"Data.x: int", "Data.y: int"}) } + +@(test) +ast_completion_empty_selector_before_label :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + Foo :: struct { + bar: int, + } + + main :: proc() { + foo: Foo + foo.{*} + + Label: { + + } + } + `, + } + test.expect_completion_docs(t, &source, "", {"Foo.bar: int"}) +} + +@(test) +ast_completion_empty_selector_if_init :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + Foo :: struct { + bar: int, + } + + main :: proc() { + foo: Foo + if bar := foo.{*} + } + `, + } + test.expect_completion_docs(t, &source, "", {"Foo.bar: int"}) +} + +@(test) +ast_completion_empty_selector_switch_init :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + Bar :: enum { + A, B, + } + + Foo :: struct { + bar: Bar, + } + + main :: proc() { + foo: Foo + switch bar := foo.{*} + } + `, + } + test.expect_completion_docs(t, &source, "", {"Foo.bar: test.Bar"}) +} + +@(test) +ast_completion_empty_selector_for_init :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + + Foo :: struct { + bars: [5]int, + } + + main :: proc() { + foo: Foo + for bars := foo.{*} + } + `, + } + test.expect_completion_docs(t, &source, "", {"Foo.bars: [5]int"}) +} -- cgit v1.2.3