selfhost: trait bounds parsing, sema checks, and generic monomorphization fix

- AST: add typeParam0Bound/typeParam1Bound to Decl, strValue2 to dkImpl
- Parser: parse <T: Trait> bounds, Self type in interfaces, extend-for blocks
- Sema: add interfaceTable/methodTable, Sema_CheckTraitBounds, Sema_TypeImplements
- HIR lower: two-pass decl iteration — collect generic funcs before lowering bodies
  Fixes Max<Circle>(...) not generating Max_Circle when caller precedes callee
- C backend: skip generic funcs in emission (only emit monomorphized instances)
- Array.bux: fix for-loop over monomorphized Array types
- All debug prints removed; selfhost loop passes (C output IDENTICAL)
This commit is contained in:
2026-06-10 08:48:10 +03:00
parent 499b389ba8
commit f63cbd1bf0
6 changed files with 435 additions and 74 deletions
+6
View File
@@ -714,6 +714,12 @@ func CBE_FuncHasGeneric(f: *HirFunc) -> bool {
return false;
}
func CBE_IsArrayTypeName(name: String) -> bool {
if String_Eq(name, "") { return false; }
if String_StartsWith(name, "Array") { return true; }
return false;
}
func CBE_IsPrimitiveTypeName(name: String) -> bool {
if String_Eq(name, "int") || String_Eq(name, "") { return true; }
if String_Eq(name, "String") { return true; }