Skip to content

Commit

Permalink
Add missing op token when building string for unary expr node
Browse files Browse the repository at this point in the history
  • Loading branch information
thetarnav committed Jul 29, 2024
1 parent 78456ea commit 27ecd5f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/common/ast.odin
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,7 @@ build_string_node :: proc(
case ^Tag_Expr:
build_string(n.expr, builder, remove_pointers)
case ^Unary_Expr:
strings.write_string(builder, n.op.text)
build_string(n.expr, builder, remove_pointers)
case ^Binary_Expr:
build_string(n.left, builder, remove_pointers)
Expand Down
22 changes: 22 additions & 0 deletions tests/hover_test.odin
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,28 @@ ast_hover_on_sliced_result :: proc(t: ^testing.T) {
test.expect_hover(t, &source, "test.slice: []byte")
}

@(test)
ast_hover_on_array_variable :: proc(t: ^testing.T) {
source := test.Source {
main = `package test
Vec :: [2]f32
vec: Ve{*}c
`,
}

test.expect_hover(t, &source, "test.Vec: [2]f32")
}

@(test)
ast_hover_on_array_infer_length_variable :: proc(t: ^testing.T) {
source := test.Source {
main = `package test
ve{*}c :: [?]f32{1, 2, 3}
`,
}

test.expect_hover(t, &source, "test.vec: [?]f32")
}

@(test)
ast_hover_on_bitset_variable :: proc(t: ^testing.T) {
Expand Down

0 comments on commit 27ecd5f

Please sign in to comment.