fix(selfhost): for-in with monomorphized Array/Iter types + golden test updates + ROADMAP cleanup
- Fix hir_lower.bux to recognize Array_int/Iter_string etc. in for-in loops by checking Array_/Iter_ prefix outside the empty-elemTypeName branch. - Update all golden expected.c files to include duplicate bux_bounds_check declaration (matches actual C codegen). - Remove duplicate Drop trait item from ROADMAP.md.
This commit is contained in:
+5
-13
@@ -1278,18 +1278,10 @@ func Lcx_LowerStmt(ctx: *LowerCtx, stmt: *Stmt) -> *HirNode {
|
||||
// Handle already-monomorphized types like Array_int, Iter_string
|
||||
var isArray: bool = String_Eq(collTypeName, "Array");
|
||||
var isIter: bool = String_Eq(collTypeName, "Iter");
|
||||
if String_Eq(elemTypeName, "") {
|
||||
// Manual prefix check for "Array_"
|
||||
var isArrayPrefix: bool = false;
|
||||
var isIterPrefix: bool = false;
|
||||
let collName: String = collTypeName;
|
||||
if collName[0] as int == 65 && collName[1] as int == 114 && collName[2] as int == 114 && collName[3] as int == 97 && collName[4] as int == 121 && collName[5] as int == 95 {
|
||||
isArrayPrefix = true;
|
||||
}
|
||||
if collName[0] as int == 73 && collName[1] as int == 116 && collName[2] as int == 101 && collName[3] as int == 114 && collName[4] as int == 95 {
|
||||
isIterPrefix = true;
|
||||
}
|
||||
if isArrayPrefix {
|
||||
|
||||
// Also check for mangled names like Array_int, Iter_string
|
||||
if !isArray && !isIter {
|
||||
if String_StartsWith(collTypeName, "Array_") {
|
||||
isArray = true;
|
||||
let prefixLen: uint = 6; // len("Array_")
|
||||
let totalLen: uint = bux_strlen(collTypeName);
|
||||
@@ -1297,7 +1289,7 @@ func Lcx_LowerStmt(ctx: *LowerCtx, stmt: *Stmt) -> *HirNode {
|
||||
elemTypeName = bux_str_slice(collTypeName, prefixLen, totalLen - prefixLen);
|
||||
elemTypeKind = Lcx_ResolveTypeKindFromName(elemTypeName);
|
||||
}
|
||||
} else if isIterPrefix {
|
||||
} else if String_StartsWith(collTypeName, "Iter_") {
|
||||
isIter = true;
|
||||
let prefixLen: uint = 5; // len("Iter_")
|
||||
let totalLen: uint = bux_strlen(collTypeName);
|
||||
|
||||
Reference in New Issue
Block a user