fix(bootstrap): type compatibility fixes for self-hosting

- Allow int32 <-> int and uint32 <-> int/uint comparisons
- Allow uint32 <-> int32 comparisons
- Allow String indexing (returns char8)
- Allow *char8 -> String assignment (C string literal to Bux String)

These fixes allow buxc2 (self-hosted compiler) to build successfully.
All 14 modules compile; buxc2 binary is 111KB.
This commit is contained in:
2026-06-01 00:17:54 +03:00
parent e551951219
commit 837fbb0487
2 changed files with 15 additions and 0 deletions
+2
View File
@@ -883,6 +883,8 @@ proc checkExpr(sema: var Sema, expr: Expr, scope: Scope): Type =
return obj.inner[0]
elif obj.isPointer:
return obj.inner[0]
elif obj.kind == tkStr:
return makeChar8()
else:
sema.emitError(expr.loc, "cannot index non-slice/non-pointer type")
return makeUnknown()