diff options
| author | Daniel Gavin <danielgavin5@hotmail.com> | 2022-06-12 01:24:58 +0200 |
|---|---|---|
| committer | Daniel Gavin <danielgavin5@hotmail.com> | 2022-06-12 01:24:58 +0200 |
| commit | 12a1db1e284e4ce2af9a51bb60f9817e76c1a481 (patch) | |
| tree | 442d055f164e24d5e082c610ef90a8678fdc1066 /tests | |
| parent | 7f3d3d2c5c88e528d59ca5fd5ae823f2e1b21ea9 (diff) | |
Fix bugs with range loop in switch statement not completing.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/completions_test.odin | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/completions_test.odin b/tests/completions_test.odin index 6763bed..f9e93da 100644 --- a/tests/completions_test.odin +++ b/tests/completions_test.odin @@ -1642,3 +1642,36 @@ ast_for_in_range_half_completion_2 :: proc(t: ^testing.T) { test.expect_completion_details(t, &source, ".", {"test.n: int"}) } + +@(test) +ast_for_in_switch_type :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + My_Foo :: struct { + bar: int, + } + + My_Struct :: struct { + my: []My_Foo, + } + + My_Union :: union { + My_Struct, + } + + main :: proc() { + my_union: My_Union + switch v in my_union { + case My_Struct: + for item in v.my { + item.* + } + } + } + `, + packages = {}, + } + + test.expect_completion_details(t, &source, ".", {"My_Foo.bar: int"}) +} + |