diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-06-13 21:05:46 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-06-13 21:05:46 -0400 |
| commit | e31dfce18bd64cbf7dcceb1f8718fc5b1e94450c (patch) | |
| tree | 30df4b989d17d294d56b0405f6dd228022aa2416 /tests | |
| parent | 135e03599cc33831de46181aef69ffce24976f3d (diff) | |
Correctly handle type casts
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/type_definition_test.odin | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/type_definition_test.odin b/tests/type_definition_test.odin index e2003df..0e41b5e 100644 --- a/tests/type_definition_test.odin +++ b/tests/type_definition_test.odin @@ -839,3 +839,32 @@ ast_type_definition_array_of_pointers :: proc(t: ^testing.T) { test.expect_type_definition_locations(t, &source, {location}) } + +@(test) +ast_type_definition_type_cast :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + + Foo :: struct { + bar: int, + } + + main :: proc() { + data: ^int + foo := cast(^Foo)data + + bar := fo{*}o.bar + } + `, + } + + location := common.Location { + range = { + start = {line = 2, character = 2}, + end = {line = 2, character = 5}, + }, + } + + test.expect_type_definition_locations(t, &source, {location}) +} + |