diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-07-25 15:38:48 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-07-25 15:38:48 -0400 |
| commit | 337ddab8eeb831dc4058a06b9ba83ebec0a40ddf (patch) | |
| tree | 8bf3372ca2d4a7e45766fa8d7da46a53e0496a7b /tests | |
| parent | 3d51d3ab487d363d39f5c9e2218ebf0163029bb1 (diff) | |
Correctly infer return type enum fields for completions
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/completions_test.odin | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/completions_test.odin b/tests/completions_test.odin index bae9476..21f10a7 100644 --- a/tests/completions_test.odin +++ b/tests/completions_test.odin @@ -3973,3 +3973,57 @@ ast_completion_bitset_named_proc_arg_should_remove_already_used :: proc(t: ^test } test.expect_completion_details(t, &source, "", {"B"}, {"A"}) } + +@(test) +ast_completion_return_comp_lit_enum :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + + Foo :: enum { + A, + B, + } + + Bar :: struct { + foo: Foo, + } + + foo :: proc() -> Bar { + return { + foo = .{*} + } + } + `, + } + test.expect_completion_details(t, &source, "", {"A", "B"}) +} + +@(test) +ast_completion_return_nested_comp_lit_enum :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + + Foo :: enum { + A, + B, + } + + Bar :: struct { + foo: Foo, + } + + Bazz :: struct { + bar: Bar, + } + + foo :: proc() -> Bazz { + return { + bar = { + foo = .{*} + } + } + } + `, + } + test.expect_completion_details(t, &source, "", {"A", "B"}) +} |