diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2025-06-05 19:11:35 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-05 19:11:35 +0200 |
| commit | c2a2283bf4e0cc2c2b25a6ee2014a18c3b11f3c7 (patch) | |
| tree | f12e8c7c50acb9365cdf947e370a8f2de5189ce9 /tests | |
| parent | 4fb3c51850eadffe0091dcd297ff284526dca601 (diff) | |
| parent | 0e3ef1f2d7a9b0ee19a4b12c3dfadf15a8d5f4b2 (diff) | |
Merge pull request #647 from BradLewis/master
Resolve assignments before switch statements position context
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/definition_test.odin | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/definition_test.odin b/tests/definition_test.odin index cd32628..ced4256 100644 --- a/tests/definition_test.odin +++ b/tests/definition_test.odin @@ -353,3 +353,42 @@ ast_goto_implicit_enum_infer_from_function :: proc(t: ^testing.T) { test.expect_definition_locations(t, &source, {location}) } + +@(test) +ast_goto_implicit_enum_infer_from_assignment_within_switch :: proc(t: ^testing.T) { + source := test.Source{ + main = `package test + Bar :: enum { + Bar1, + Bar2, + } + + Foo :: enum { + Foo1, + Foo2, + } + + + main :: proc() { + my_foo: Foo + my_bar: Bar + switch my_foo { + case .Foo1: + my_bar = .B{*}ar2 + case .Foo2: + my_bar = .Bar1 + } + } + `, + packages = {}, + } + + location := common.Location { + range = { + start = {line = 3, character = 3}, + end = {line = 3, character = 7}, + }, + } + + test.expect_definition_locations(t, &source, {location}) +} |