diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2024-06-09 15:54:13 +0200 |
|---|---|---|
| committer | DanielGavin <danielgavin5@hotmail.com> | 2024-06-09 15:54:13 +0200 |
| commit | e9ea799cf2460cf8598d68fcb908fb50ee1dc4cf (patch) | |
| tree | 073594786a7f3e4eed66818a9f752740215d86a9 /tests | |
| parent | c892cc8e8daad497bb57e38218a0f5fc0d309e44 (diff) | |
Support comp lit inference from return
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/references_test.odin | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/references_test.odin b/tests/references_test.odin index cadaff4..61c9cd0 100644 --- a/tests/references_test.odin +++ b/tests/references_test.odin @@ -179,3 +179,42 @@ reference_field_comp_lit_infer_from_function :: proc(t: ^testing.T) { }, ) } + +@(test) +reference_field_comp_lit_infer_from_return :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + Foo :: struct { + soo_many_cases: int, + } + + My_Struct :: struct { + foo: Foo, + } + + my_function :: proc() -> My_Struct { + return {foo = {soo_many_cases{*} = 2}} + } + `, + packages = {}, + } + + test.expect_reference_locations( + t, + &source, + { + { + range = { + start = {line = 2, character = 3}, + end = {line = 2, character = 17}, + }, + }, + { + range = { + start = {line = 10, character = 18}, + end = {line = 10, character = 32}, + }, + }, + }, + ) +} |