diff --git a/App/lib/core/Gen/Type/TypeGenResolve.vp b/App/lib/core/Gen/Type/TypeGenResolve.vp index dc62e16..a8cc4c8 100644 --- a/App/lib/core/Gen/Type/TypeGenResolve.vp +++ b/App/lib/core/Gen/Type/TypeGenResolve.vp @@ -840,6 +840,17 @@ novirtual class TypeGenResolve(TypeGenBase.TypeGenBase): lib_ty: mlirlite.LLVMType* = self.resolve_annotation_type(pool, lib_node, imported_modules, from_imports, trans, 1) self.Gen.TypeGenCType.CTypedefResolveDepth -= 1 if lib_ty is not None: return lib_ty + # Bare Python/C builtin aliases: map_t_type only knows the t.CXxx spelling, so + # resolve them here to match resolve_annotation_type's bare-name branch. Without + # this the two-arg form int(x, t.CPtr) misses _tc_h4 and fails fast as "int". + if string.strcmp(name, "str") == 0: return mlirlite.Ptr(pool, mlirlite.Int8(pool)) + if string.strcmp(name, "bytes") == 0: return mlirlite.Ptr(pool, mlirlite.Int8(pool)) + if string.strcmp(name, "int") == 0: return mlirlite.Int32(pool) + if string.strcmp(name, "char") == 0: return mlirlite.Int8(pool) + if string.strcmp(name, "bool") == 0: return mlirlite.Int1(pool) + if string.strcmp(name, "float") == 0: return mlirlite.Float(pool) + if string.strcmp(name, "double") == 0: return mlirlite.Double(pool) + if string.strcmp(name, "void") == 0: return mlirlite.Void(pool) return self.map_t_type(pool, name) def get_type_size_bytes(self, pool: memhub.MemBuddy*, name: str, imported_modules: str, from_imports: str) -> int: """Return the type size in bytes via resolve_typedef_or_map, or 0 on failure."""