aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-07 14:01:31 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-07 14:04:01 -0400
commit81dfb4de0cd5855e2cc719abe8d3f44f951949dc (patch)
tree4142aaf2395e528035bd9a7745a01b83a855d365 /tests
parent0a254711a65bea797dc64946d64b9c614460a93a (diff)
Fix issue resolving struct fields when constructed in a return statement
Diffstat (limited to 'tests')
-rw-r--r--tests/references_test.odin31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/references_test.odin b/tests/references_test.odin
index cac6e9e..c4665d8 100644
--- a/tests/references_test.odin
+++ b/tests/references_test.odin
@@ -792,3 +792,34 @@ ast_reference_struct_and_enum_variant_same_name :: proc(t: ^testing.T) {
test.expect_reference_locations(t, &source, locations[:], expect_excluded)
}
+
+@(test)
+ast_reference_enum_variants_comp_lit_return :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+
+ Foo :: enum {
+ A,
+ B,
+ }
+
+ Bar :: struct {
+ foo: Foo,
+ }
+
+ foo :: proc() -> Bar {
+ return Bar {
+ foo = .A{*},
+ }
+ }
+
+ `,
+ }
+
+ locations := []common.Location {
+ {range = {start = {line = 3, character = 3}, end = {line = 3, character = 4}}},
+ {range = {start = {line = 13, character = 11}, end = {line = 13, character = 12}}},
+ }
+
+ test.expect_reference_locations(t, &source, locations[:])
+}