From 558f690a8d962b658986bc28fa1e5603098674c1 Mon Sep 17 00:00:00 2001 From: Brad Lewis <22850972+BradLewis@users.noreply.github.com> Date: Tue, 19 Aug 2025 12:19:01 -0400 Subject: Correctly resolve string indexing --- tests/hover_test.odin | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'tests') diff --git a/tests/hover_test.odin b/tests/hover_test.odin index 16bbf69..8d7f7c9 100644 --- a/tests/hover_test.odin +++ b/tests/hover_test.odin @@ -4261,6 +4261,45 @@ ast_hover_proc_within_for_loop :: proc(t: ^testing.T) { } test.expect_hover(t, &source, "test.foo: proc()") } + +@(test) +ast_hover_string_slice_range :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + main :: proc() { + foo: string + ba{*}r := foo[1:2] + } + `, + } + test.expect_hover(t, &source, "test.bar: string") +} + +@(test) +ast_hover_string_index :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + main :: proc() { + foo: string + ba{*}r := foo[1] + } + `, + } + test.expect_hover(t, &source, "test.bar: u8") +} + +@(test) +ast_hover_untyped_string_index :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + main :: proc() { + foo := "hellope" + ba{*}r := foo[1] + } + `, + } + test.expect_hover(t, &source, "test.bar: u8") +} /* Waiting for odin fix -- cgit v1.2.3