diff options
| author | Bradley Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-10-30 16:45:40 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-30 16:45:40 -0400 |
| commit | 4fc217ef397898d8251ad8391895f2da22cbb848 (patch) | |
| tree | 7ff01f584744bd43bc844061eb054d178dbe8ebf | |
| parent | a6357c1cd8085774765d2618e5a34aaf163d560e (diff) | |
| parent | dee527bf31a01be1effbe93377ec5018a01afa03 (diff) | |
Merge pull request #1138 from BradLewis/fix/completions-selector-casts
| -rw-r--r-- | src/server/analysis.odin | 8 | ||||
| -rw-r--r-- | tests/completions_test.odin | 23 |
2 files changed, 29 insertions, 2 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin index 56d7843..4ed56b7 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -1180,9 +1180,13 @@ internal_resolve_type_expression :: proc(ast_context: ^AstContext, node: ^ast.Ex out^, ok = resolve_basic_lit(ast_context, v^) return ok case ^Type_Cast: - return internal_resolve_type_expression(ast_context, v.type, out) + ok = internal_resolve_type_expression(ast_context, v.type, out) + out.type = .Variable + return ok case ^Auto_Cast: - return internal_resolve_type_expression(ast_context, v.expr, out) + ok = internal_resolve_type_expression(ast_context, v.expr, out) + out.type = .Variable + return ok case ^Comp_Lit: return internal_resolve_type_expression(ast_context, v.type, out) case ^Unary_Expr: diff --git a/tests/completions_test.odin b/tests/completions_test.odin index a4e8ab0..628107a 100644 --- a/tests/completions_test.odin +++ b/tests/completions_test.odin @@ -4866,3 +4866,26 @@ ast_completion_proc_enum_default_value :: proc(t: ^testing.T) { } test.expect_completion_docs(t, &source, "", {"A", "B", "C"}) } + +@(test) +ast_completion_cast_rawptr_selector :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + + Foo :: struct { + bar: bool, + } + + Baz :: struct { + foo: Foo, + } + + main :: proc() { + baz: Baz + baz_ptr := &baz + foo_ptr := (cast(^Foo)rawptr(baz_ptr)).{*} + } + `, + } + test.expect_completion_docs(t, &source, "", {"Foo.bar: bool"}) +} |