From f7ede8632f59a6f3a2f34fbb81716a3b65ac759b Mon Sep 17 00:00:00 2001 From: gingerBill Date: Tue, 17 Mar 2026 08:10:13 +0000 Subject: [PATCH] Minor changes --- src/check_stmt.cpp | 4 ++-- src/checker.hpp | 4 ++-- src/types.cpp | 13 ++++++++++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index bc7605e0d..a690308cb 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -789,10 +789,10 @@ gb_internal bool check_using_stmt_entity(CheckerContext *ctx, AstUsingStmt *us, defer (rw_mutex_unlock(&scope->mutex)); for (auto const &entry : scope->elements) { - String name = scope->elements.keys[entry.hash & (scope->elements.cap-1)]; - u32 hash = entry.hash; Entity *decl = entry.value; if (!is_entity_exported(decl, true)) continue; + String name = scope->elements.keys[entry.hash & (scope->elements.cap-1)]; + u32 hash = entry.hash; Entity *found = scope_insert_with_name(ctx->scope, name, hash, decl); if (found != nullptr) { diff --git a/src/checker.hpp b/src/checker.hpp index 226a4ba6a..ef68f9c74 100644 --- a/src/checker.hpp +++ b/src/checker.hpp @@ -278,10 +278,10 @@ struct ScopeMapSlot { enum { SCOPE_MAP_INLINE_CAP = 16 }; struct ScopeMap { + String inline_keys [SCOPE_MAP_INLINE_CAP]; ScopeMapSlot inline_slots[SCOPE_MAP_INLINE_CAP]; - String inline_keys[SCOPE_MAP_INLINE_CAP]; - ScopeMapSlot *slots; String * keys; + ScopeMapSlot *slots; u32 count; u32 cap; }; diff --git a/src/types.cpp b/src/types.cpp index a431e470e..f82e54802 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -978,7 +978,6 @@ gb_internal void set_base_type(Type *t, Type *base) { gb_internal Type *alloc_type(TypeKind kind) { - // gbAllocator a = heap_allocator(); Type *t = permanent_alloc_item(); t->kind = kind; t->cached_size = -1; @@ -1139,8 +1138,8 @@ gb_internal Type *alloc_type_union() { gb_internal Type *alloc_type_enum() { Type *t = alloc_type(Type_Enum); - t->Enum.min_value = gb_alloc_item(permanent_allocator(), ExactValue); - t->Enum.max_value = gb_alloc_item(permanent_allocator(), ExactValue); + t->Enum.min_value = permanent_alloc_item(); + t->Enum.max_value = permanent_alloc_item(); return t; } @@ -3049,6 +3048,10 @@ gb_internal bool are_types_identical_unique_tuples(Type *x, Type *y) { return false; } + if (x->canonical_hash && y->canonical_hash && x->canonical_hash != y->canonical_hash) { + return false; + } + // MUTEX_GUARD(&g_type_mutex); return are_types_identical_internal(x, y, true); } @@ -3063,6 +3066,10 @@ gb_internal bool are_types_identical_internal(Type *x, Type *y, bool check_tuple return false; } + if (x->canonical_hash && y->canonical_hash && x->canonical_hash != y->canonical_hash) { + return false; + } + #if 0 if (x->kind == Type_Named) { Entity *e = x->Named.type_name;