fix(selfhost): collection-based for-in with Std::Array + monomorphization fixes

- Fix Fmt_Format name conflict between lib/Fmt.bux and src/fmt.bux
  by renaming selfhost formatter function to Fmt_FormatSource.

- Fix collection-based for-in loops to handle already-monomorphized
  types like Array_int and Iter_string (typeArgCount=0 cases).

- Fix ekSizeOf and ekCast in HIR lowering to apply Lcx_SubstituteType
  during generic monomorphization, so sizeof(T) and *T casts emit
  correct concrete types in C output.

- Fix sema to infer stmt.refStmtType from initializer expression
  when no explicit type annotation is given, ensuring C backend
  emits correct pointer types for let data = ... as *T.
This commit is contained in:
2026-06-10 01:15:21 +03:00
parent 632fa1535c
commit 499b389ba8
3 changed files with 59 additions and 11 deletions
+2 -2
View File
@@ -73,7 +73,7 @@ func Fmt_CountBraceDelta(line: String) -> int {
return delta;
}
func Fmt_Format(source: String) -> String {
func Fmt_FormatSource(source: String) -> String {
let sb: StringBuilder = StringBuilder_NewCap(8192);
var indent: int = 0;
var i: uint = 0;
@@ -130,7 +130,7 @@ func Fmt_Format(source: String) -> String {
func Fmt_FormatFile(path: String) -> bool {
let source: String = bux_read_file(path);
if source == null as String || String_Eq(source, "") { return false; }
let formatted: String = Fmt_Format(source);
let formatted: String = Fmt_FormatSource(source);
if String_Eq(formatted, "") { return false; }
return bux_write_file(path, formatted);
}