aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-09-11 21:29:56 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-09-11 21:52:50 -0400
commit4cb9acda12fa0bb0a0b6fd6d46c163adc0544a4a (patch)
tree2dab8c6a774f0be610048b145081f08f9f6f2282 /tests
parente90a29ed4682530243e10ae91e880ed2eeba4dfd (diff)
Resolve references for bit field fields
Diffstat (limited to 'tests')
-rw-r--r--tests/references_test.odin75
1 files changed, 75 insertions, 0 deletions
diff --git a/tests/references_test.odin b/tests/references_test.odin
index c6e4438..0b8b5c0 100644
--- a/tests/references_test.odin
+++ b/tests/references_test.odin
@@ -1384,3 +1384,78 @@ ast_references_comp_lit_map_value :: proc(t: ^testing.T) {
test.expect_reference_locations(t, &source, locations[:])
}
+
+@(test)
+ast_references_nested_using_struct_field :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ Foo :: struct {
+ a: int,
+ using _: struct {
+ b: u8,
+ }
+ }
+
+ main :: proc() {
+ foo: Foo
+ b := foo.b{*}
+ }
+ `,
+ }
+ locations := []common.Location {
+ {range = {start = {line = 4, character = 4}, end = {line = 4, character = 5}}},
+ {range = {start = {line = 10, character = 12}, end = {line = 10, character = 13}}},
+ }
+
+ test.expect_reference_locations(t, &source, locations[:])
+}
+
+@(test)
+ast_references_nested_using_bit_field_field :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ Foo :: struct {
+ a: int,
+ using _: bit_field u8 {
+ b: u8 | 4
+ }
+ }
+
+ main :: proc() {
+ foo: Foo
+ b := foo.b{*}
+ }
+ `,
+ }
+ locations := []common.Location {
+ {range = {start = {line = 4, character = 4}, end = {line = 4, character = 5}}},
+ {range = {start = {line = 10, character = 12}, end = {line = 10, character = 13}}},
+ }
+
+ test.expect_reference_locations(t, &source, locations[:])
+}
+
+@(test)
+ast_references_nested_using_bit_field_field_from_declaration :: proc(t: ^testing.T) {
+ source := test.Source {
+ main = `package test
+ Foo :: struct {
+ a: int,
+ using _: bit_field u8 {
+ b{*}: u8 | 4
+ }
+ }
+
+ main :: proc() {
+ foo: Foo
+ b := foo.b
+ }
+ `,
+ }
+ locations := []common.Location {
+ {range = {start = {line = 4, character = 4}, end = {line = 4, character = 5}}},
+ {range = {start = {line = 10, character = 12}, end = {line = 10, character = 13}}},
+ }
+
+ test.expect_reference_locations(t, &source, locations[:])
+}