aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-30 20:01:41 -0400
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-07-30 20:01:41 -0400
commit9662d034880dfcfe49474aba0589d8d831a04584 (patch)
tree642288f99bceb9d6b13d88f60c9b722f375be4c2 /src
parent0e4157ebfd357e5fdb181408185cca42dcd24047 (diff)
Correctly handle the alias of `u8` and `byte`
Diffstat (limited to 'src')
-rw-r--r--src/server/analysis.odin5
-rw-r--r--src/server/ast.odin11
2 files changed, 15 insertions, 1 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin
index 81fe560..f02448a 100644
--- a/src/server/analysis.odin
+++ b/src/server/analysis.odin
@@ -366,7 +366,7 @@ are_symbol_untyped_basic_same_typed :: proc(a, b: Symbol) -> (bool, bool) {
switch untyped.type {
case .Integer:
switch basic.ident.name {
- case "int", "uint", "u8", "i8", "u16", "i16", "u32", "i32", "u64", "i64", "u128", "i128":
+ case "int", "uint", "u8", "i8", "u16", "i16", "u32", "i32", "u64", "i64", "u128", "i128", "byte":
return true, true
case:
return false, true
@@ -401,6 +401,9 @@ are_symbol_untyped_basic_same_typed :: proc(a, b: Symbol) -> (bool, bool) {
}
are_symbol_basic_same_keywords :: proc(a, b: Symbol) -> bool {
+ if are_keyword_aliases(a.name, b.name) {
+ return true
+ }
if a.name != b.name {
return false
}
diff --git a/src/server/ast.odin b/src/server/ast.odin
index 8037d6f..79f14f6 100644
--- a/src/server/ast.odin
+++ b/src/server/ast.odin
@@ -70,6 +70,17 @@ keyword_map: map[string]bool = {
"uintptr" = true,
}
+are_keyword_aliases :: proc(a, b: string) -> bool {
+ // right now only the only alias is `byte` for `u8`, so this simple check will do
+ if a == "u8" && b == "byte" {
+ return true
+ }
+ if a == "byte" && b == "u8" {
+ return true
+ }
+ return false
+}
+
GlobalExpr :: struct {
name: string,
name_expr: ^ast.Expr,