diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-09-11 21:12:31 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-09-11 21:12:31 -0400 |
| commit | e90a29ed4682530243e10ae91e880ed2eeba4dfd (patch) | |
| tree | d081166740bd969c3caa811f5b05b2993eb7b39e /tests | |
| parent | 968712e40186abaf5447f69cc73b197af9d94600 (diff) | |
Correctly resolve go to definition for nested using bitfields on structs
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/definition_test.odin | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/definition_test.odin b/tests/definition_test.odin index 261ef83..6e7c7a4 100644 --- a/tests/definition_test.odin +++ b/tests/definition_test.odin @@ -627,3 +627,51 @@ ast_goto_soa_field :: proc(t: ^testing.T) { test.expect_definition_locations(t, &source, locations[:]) } + +@(test) +ast_goto_nested_using_bit_field_field :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + Foo :: struct { + a: int, + using _: bit_field u8 { + b: u8 | 4 + } + } + + main :: proc() { + foo: Foo + b := foo.b{*} + } + `, + } + locations := []common.Location { + {range = {start = {line = 4, character = 4}, end = {line = 4, character = 5}}}, + } + + test.expect_definition_locations(t, &source, locations[:]) +} + +@(test) +ast_goto_nested_using_struct_field :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + Foo :: struct { + a: int, + using _: struct { + b: u8 + } + } + + main :: proc() { + foo: Foo + b := foo.b{*} + } + `, + } + locations := []common.Location { + {range = {start = {line = 4, character = 4}, end = {line = 4, character = 5}}}, + } + + test.expect_definition_locations(t, &source, locations[:]) +} |