diff options
| -rw-r--r-- | src/server/references.odin | 4 | ||||
| -rw-r--r-- | tests/references_test.odin | 21 |
2 files changed, 23 insertions, 2 deletions
diff --git a/src/server/references.odin b/src/server/references.odin index f7be8c6..339be89 100644 --- a/src/server/references.odin +++ b/src/server/references.odin @@ -102,8 +102,8 @@ prepare_references :: proc( found := false for variant in position_context.union_type.variants { if position_in_node(variant, position_context.position) { - if ident, ok := variant.derived.(^ast.Ident); ok { - symbol, ok = resolve_location_identifier(ast_context, ident^) + if ident, _, ok := unwrap_pointer_ident(variant); ok { + symbol, ok = resolve_location_identifier(ast_context, ident) resolve_flag = .Identifier if !ok { diff --git a/tests/references_test.odin b/tests/references_test.odin index 0b8b5c0..d0d99f1 100644 --- a/tests/references_test.odin +++ b/tests/references_test.odin @@ -1459,3 +1459,24 @@ ast_references_nested_using_bit_field_field_from_declaration :: proc(t: ^testing test.expect_reference_locations(t, &source, locations[:]) } + +@(test) +ast_references_union_member_pointer :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + Foo :: struct{} + + Foos :: union { + Foo, + ^F{*}oo, + } + `, + } + locations := []common.Location { + {range = {start = {line = 1, character = 2}, end = {line = 1, character = 5}}}, + {range = {start = {line = 4, character = 3}, end = {line = 4, character = 6}}}, + {range = {start = {line = 5, character = 4}, end = {line = 5, character = 7}}}, + } + + test.expect_reference_locations(t, &source, locations[:]) +} |