diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-08-19 17:26:53 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-08-19 17:26:53 -0400 |
| commit | bda66b71a2473a8a8da04588f96a2d2eae08ba3f (patch) | |
| tree | a64e3a82addfc6ada94a37002bd1516e4d7ee358 | |
| parent | b0879461c957d13531b743a367180a8bdd7a2bd8 (diff) | |
Resolve multipointer slice ranges
| -rw-r--r-- | src/server/analysis.odin | 4 | ||||
| -rw-r--r-- | tests/hover_test.odin | 13 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin index 1ca15a8..97f18d8 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -1247,7 +1247,7 @@ resolve_index_expr :: proc(ast_context: ^AstContext, v: ^ast.Index_Expr) -> (Sym return {}, false case SymbolUntypedValue: if v2.type == .String { - value := SymbolBasicValue{ + value := SymbolBasicValue { ident = ast.new(ast.Ident, v2.tok.pos, v2.tok.pos), } value.ident.name = "u8" @@ -1900,6 +1900,8 @@ resolve_slice_expression :: proc(ast_context: ^AstContext, slice_expr: ^ast.Slic expr = v.expr case SymbolDynamicArrayValue: expr = v.expr + case SymbolMultiPointerValue: + expr = v.expr case SymbolUntypedValue: if v.type == .String { return symbol, true diff --git a/tests/hover_test.odin b/tests/hover_test.odin index c043e01..1a94c89 100644 --- a/tests/hover_test.odin +++ b/tests/hover_test.odin @@ -4302,6 +4302,19 @@ ast_hover_untyped_string_index :: proc(t: ^testing.T) { } test.expect_hover(t, &source, "test.bar: u8") } + +@(test) +ast_hover_multi_pointer_slice_range :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + main :: proc() { + foo: [^]int + b{*}ar := foo[:1] + } + `, + } + test.expect_hover(t, &source, "test.bar: []int") +} /* Waiting for odin fix |