diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-11-29 19:43:56 -0500 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-11-29 19:50:26 -0500 |
| commit | 5e177c085afdea823cf635c22894f89855434d28 (patch) | |
| tree | e94ad4108744e43067b0f07a069f060c77250919 /tests | |
| parent | a5f43fd98dc7b853cf6c198a51d424886b66ea42 (diff) | |
Correctly resolve type assertions with unary exprs
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/hover_test.odin | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/hover_test.odin b/tests/hover_test.odin index 06d3dce..81c732a 100644 --- a/tests/hover_test.odin +++ b/tests/hover_test.odin @@ -5716,6 +5716,60 @@ ast_hover_bitshift_integer_type :: proc(t: ^testing.T) { } test.expect_hover(t, &source, "test.bar: int") } + +@(test) +ast_hover_type_assertion_unary_value :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + Foo :: union { + int, + f64, + } + + main :: proc() { + foo := Foo(0.0) + i{*} := &foo.(int) + } + `, + } + test.expect_hover(t, &source, "test.i: ^int") +} + +@(test) +ast_hover_type_assertion_unary_value_value :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + Foo :: union { + int, + f64, + } + + main :: proc() { + foo := Foo(0.0) + i{*}, ok := &foo.(int) + } + `, + } + test.expect_hover(t, &source, "test.i: ^int") +} + +@(test) +ast_hover_type_assertion_unary_value_ok :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + Foo :: union { + int, + f64, + } + + main :: proc() { + foo := Foo(0.0) + i, ok{*} := &foo.(int) + } + `, + } + test.expect_hover(t, &source, "test.ok: bool") +} /* Waiting for odin fix |