diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-09-01 07:51:20 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-09-01 07:55:49 -0400 |
| commit | a0dc065d1cdf27fee586b6fd1d2f2addcf928f8b (patch) | |
| tree | 69c614243845262ff88c802b75eb3a04a4d07b1b /tests | |
| parent | 68a7b0228bd024c49564e1df98a55f8b61065417 (diff) | |
Improve resolving symbols on struct field container types
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/references_test.odin | 88 |
1 files changed, 79 insertions, 9 deletions
diff --git a/tests/references_test.odin b/tests/references_test.odin index 2464924..c698771 100644 --- a/tests/references_test.odin +++ b/tests/references_test.odin @@ -977,26 +977,47 @@ ast_reference_struct_field_enumerated_array :: proc(t: ^testing.T) { } @(test) -ast_reference_struct_field_map :: proc(t: ^testing.T) { +ast_reference_struct_field_map_key :: proc(t: ^testing.T) { source := test.Source { main = `package test - Foo :: enum { - A, - B, + Foo :: int + + Bar :: struct {} + + Bazz :: struct { + bars: map[Fo{*}o]Bar } + `, + } - Bar :: struct { - foos: map[F{*}oo]Bazz + locations := []common.Location { + {range = {start = {line = 2, character = 2}, end = {line = 2, character = 5}}}, + {range = {start = {line = 7, character = 13}, end = {line = 7, character = 16}}}, + } + + test.expect_reference_locations(t, &source, locations[:]) +} + +@(test) +ast_reference_struct_field_map_value :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + + Foo :: int + + Bar :: struct {} + + Bazz :: struct { + bars: map[Foo]B{*}ar } - Bazz :: struct {} `, } locations := []common.Location { - {range = {start = {line = 2, character = 2}, end = {line = 2, character = 5}}}, - {range = {start = {line = 8, character = 13}, end = {line = 8, character = 16}}}, + {range = {start = {line = 4, character = 2}, end = {line = 4, character = 5}}}, + {range = {start = {line = 7, character = 17}, end = {line = 7, character = 20}}}, } test.expect_reference_locations(t, &source, locations[:]) @@ -1262,3 +1283,52 @@ ast_references_switch_cases_binary_expr :: proc(t: ^testing.T) { test.expect_reference_locations(t, &source, locations[:]) } + +@(test) +ast_reference_struct_field_matrix_row :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + + Foo :: int + + Bar :: struct {} + + Bazz :: struct { + bars: matrix[Fo{*}o, 2]Bar + } + + `, + } + + locations := []common.Location { + {range = {start = {line = 2, character = 2}, end = {line = 2, character = 5}}}, + {range = {start = {line = 7, character = 16}, end = {line = 7, character = 19}}}, + } + + test.expect_reference_locations(t, &source, locations[:]) +} + +@(test) +ast_reference_struct_field_bitfield_backing_type :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + + Foo :: int + + Bar :: struct {} + + Bazz :: struct { + bars: bit_field Fo{*}o { + } + } + + `, + } + + locations := []common.Location { + {range = {start = {line = 2, character = 2}, end = {line = 2, character = 5}}}, + {range = {start = {line = 7, character = 19}, end = {line = 7, character = 22}}}, + } + + test.expect_reference_locations(t, &source, locations[:]) +} |