From e2d38ac6415c09366dd934b75f0dd557057855f5 Mon Sep 17 00:00:00 2001 From: Brad Lewis <22850972+BradLewis@users.noreply.github.com> Date: Sun, 23 Nov 2025 16:05:48 -0500 Subject: Correct the resultant type for bitshifts --- src/server/analysis.odin | 2 ++ tests/hover_test.odin | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/server/analysis.odin b/src/server/analysis.odin index 723ec85..80370d9 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -3113,6 +3113,8 @@ resolve_binary_expression :: proc(ast_context: ^AstContext, binary: ^ast.Binary_ type = .Bool, } return symbol_a, true + case .Shl, .Shr: + return resolve_type_expression(ast_context, binary.left) } if expr, ok := binary.left.derived.(^ast.Binary_Expr); ok { diff --git a/tests/hover_test.odin b/tests/hover_test.odin index 282ffb7..06d3dce 100644 --- a/tests/hover_test.odin +++ b/tests/hover_test.odin @@ -5703,6 +5703,19 @@ ast_hover_function_call_with_parens :: proc(t: ^testing.T) { } test.expect_hover(t, &source, "test.bar: bool") } + +@(test) +ast_hover_bitshift_integer_type :: proc(t: ^testing.T) { + source := test.Source { + main = `package test + main :: proc() { + foo: u16 + b{*}ar := 6 << foo + } + `, + } + test.expect_hover(t, &source, "test.bar: int") +} /* Waiting for odin fix -- cgit v1.2.3