diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-09-07 15:30:22 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-09-07 15:34:51 -0400 |
| commit | 59d3d9efc70ec5530c52ac6a657c8778defd1819 (patch) | |
| tree | d1807e581e2b1bdfc1f798dc2c071c46169446be /src | |
| parent | 0673e745df404a5e526867c07a42ae049f43b816 (diff) | |
Improvement to resolving numeric binary expressions
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/analysis.odin | 11 | ||||
| -rw-r--r-- | src/server/hover.odin | 16 |
2 files changed, 9 insertions, 18 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin index 92082b5..ac3680c 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -2872,8 +2872,15 @@ resolve_binary_expression :: proc(ast_context: ^AstContext, binary: ^ast.Binary_ return symbol_b, true } - if _, ok := symbol_a.value.(SymbolUntypedValue); ok { - return symbol_b, ok_b + if value_a, ok := symbol_a.value.(SymbolUntypedValue); ok { + if value_b, ok := symbol_b.value.(SymbolUntypedValue); ok { + if value_a.type == .Float { + return symbol_a, true + } + return symbol_b, true + } else { + return symbol_b, ok_b + } } //Otherwise just choose the first type, we do not handle error cases - that is done with the checker return symbol_a, ok_a diff --git a/src/server/hover.odin b/src/server/hover.odin index 4941b87..960a3a2 100644 --- a/src/server/hover.odin +++ b/src/server/hover.odin @@ -18,22 +18,6 @@ import "src:common" write_hover_content :: proc(ast_context: ^AstContext, symbol: Symbol) -> MarkupContent { content: MarkupContent - - symbol := symbol - - if untyped, ok := symbol.value.(SymbolUntypedValue); ok { - switch untyped.type { - case .String: - symbol.signature = "string" - case .Bool: - symbol.signature = "bool" - case .Float: - symbol.signature = "float" - case .Integer: - symbol.signature = "int" - } - } - cat := construct_symbol_information(ast_context, symbol) doc := construct_symbol_docs(symbol) |