From e90a29ed4682530243e10ae91e880ed2eeba4dfd Mon Sep 17 00:00:00 2001 From: Brad Lewis <22850972+BradLewis@users.noreply.github.com> Date: Thu, 11 Sep 2025 21:12:31 -0400 Subject: Correctly resolve go to definition for nested using bitfields on structs --- tests/definition_test.odin | 48 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'tests') 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[:]) +} -- cgit v1.2.3