aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBradley Lewis <22850972+BradLewis@users.noreply.github.com>2025-11-24 08:09:02 +1100
committerGitHub <noreply@github.com>2025-11-24 08:09:02 +1100
commita5f43fd98dc7b853cf6c198a51d424886b66ea42 (patch)
tree1ae9fb5129175f68f2d11e8f98c1b7a0553ea9b5
parent74396f71ea35e313e6b2585db913e69cca14146e (diff)
parente2d38ac6415c09366dd934b75f0dd557057855f5 (diff)
Merge pull request #1190 from BradLewis/fix/bitshift-result-types
Correct the resultant type for bitshifts
-rw-r--r--src/server/analysis.odin2
-rw-r--r--tests/hover_test.odin13
2 files changed, 15 insertions, 0 deletions
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