From 2f08ec6e76d1825825cd6a5b9292b760782e00b4 Mon Sep 17 00:00:00 2001 From: Brad Lewis <22850972+BradLewis@users.noreply.github.com> Date: Tue, 12 Aug 2025 20:12:31 -0400 Subject: Fix go to type definition on a variable in a comp lit --- tests/type_definition_test.odin | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'tests') diff --git a/tests/type_definition_test.odin b/tests/type_definition_test.odin index c08df88..3e818bf 100644 --- a/tests/type_definition_test.odin +++ b/tests/type_definition_test.odin @@ -983,3 +983,30 @@ ast_type_definition_comp_lit_variable :: proc (t: ^testing.T) { test.expect_type_definition_locations(t, &source, locations[:]) } + +@(test) +ast_type_definition_variable_in_comp_lit :: proc (t: ^testing.T) { + source := test.Source { + main = `package test + + Foo :: struct{} + + Bar :: struct { + foo: Foo, + } + + main :: proc() { + foo := Foo{} + bar := Bar { + foo = fo{*}o, + } + } + `, + } + + locations := []common.Location { + {range = {start = {line = 2, character = 2}, end = {line = 2, character = 5}}}, + } + + test.expect_type_definition_locations(t, &source, locations[:]) +} -- cgit v1.2.3