diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-09-10 20:29:43 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-09-10 20:30:09 -0400 |
| commit | f3ae71ff7f6e3713e42c9fc65c735babba5caff0 (patch) | |
| tree | f9f4f6c98c651b41e5ce493f09b3e8b38405fc5d /tests | |
| parent | 412da606f42f29a6f03392ff385bea6a3af60bb2 (diff) | |
Resolve assign comp lits
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/hover_test.odin | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/tests/hover_test.odin b/tests/hover_test.odin index 5370804..a4769cb 100644 --- a/tests/hover_test.odin +++ b/tests/hover_test.odin @@ -4545,6 +4545,90 @@ ast_hover_proc_named_return_parens :: proc(t: ^testing.T) { } test.expect_hover(t, &source, "test.foo: proc() -> (a: int)") } + +@(test) +ast_hover_map_value_comp_lit :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + Foo :: struct { + foo: int, + } + + main :: proc() { + m: map[int]Foo + m[0] = { + f{*}oo = 1, + } + } + `, + } + test.expect_hover(t, &source, "Foo.foo: int") +} + +@(test) +ast_hover_assign_comp_lit :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + Foo :: struct { + foo: int, + } + + main :: proc() { + foo: Foo + foo = { + f{*}oo = 1, + } + } + `, + } + test.expect_hover(t, &source, "Foo.foo: int") +} + +@(test) +ast_hover_assign_comp_lit_with_multiple_assigns_first :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + Foo :: struct { + a: int, + } + + Bar :: struct { + b: int, + } + + main :: proc() { + foo: Foo + bar: Bar + + foo, bar = {a{*} = 1}, {b = 2} + } + `, + } + test.expect_hover(t, &source, "Foo.a: int") +} + +@(test) +ast_hover_assign_comp_lit_with_multiple_assigns_second :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + Foo :: struct { + a: int, + } + + Bar :: struct { + b: int, + } + + main :: proc() { + foo: Foo + bar: Bar + + foo, bar = {a = 1}, {b{*} = 2} + } + `, + } + test.expect_hover(t, &source, "Bar.b: int") +} /* Waiting for odin fix |