feat: Phase 8.2, 8.4, 8.5, 9.1 + C backend fixes
Phase 8.2 — Gradual Ownership: - Add tkRef/tkMutRef types and `mut` keyword - Add @[Checked] attribute for opt-in borrow checking - Reject assignment through &T in checked functions - examples/ownership.bux Phase 8.4 — CTFE: - Evaluate const func at compile-time via evalExpr/evalBlock - Fold const declarations to literals; emit #define in C - examples/ctfe.bux (Factorial(10) → 3628800) Phase 8.5 — Trait Bounds: - Change declFuncTypeParams from seq[string] to seq[TypeParam] (name + bound) - Parser handles <T: Comparable> - Sema checks typeImplements at call sites - Fix C backend: generic receivers + pointer self field access - examples/trait_bounds.bux Phase 9.1 — Package Manager: - Inline tables/arrays in TOML parser - bux add, bux install, bux.lock generation - Dependency resolution with git/path sources - Build pipeline merges dependency .bux sources C Backend Fixes: - resolveExprType(ekIdent) now applies typeSubst for generic params - Method desugaring works for monomorphized generic receivers - Pointer checks use isPointer (covers tkRef/tkMutRef) - Field access on &T emits -> instead of . Remove accidentally committed test binaries from tracking
This commit is contained in:
+10
-3
@@ -272,6 +272,13 @@ type
|
||||
of skDecl:
|
||||
stmtDecl*: Decl
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Type Parameters (for generics with trait bounds)
|
||||
# ---------------------------------------------------------------------------
|
||||
TypeParam* = object
|
||||
name*: string
|
||||
bounds*: seq[string] ## e.g. ["Comparable"] for <T: Comparable>
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Declarations
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -325,13 +332,13 @@ type
|
||||
declFuncCallConv*: CallingConvention
|
||||
declFuncConst*: bool ## const func — evaluable at compile time
|
||||
declFuncName*: string
|
||||
declFuncTypeParams*: seq[string]
|
||||
declFuncTypeParams*: seq[TypeParam]
|
||||
declFuncParams*: seq[Param]
|
||||
declFuncReturnType*: TypeExpr ## nil if void/inferred
|
||||
declFuncBody*: Block ## nil for signature-only
|
||||
of dkStruct:
|
||||
declStructName*: string
|
||||
declStructTypeParams*: seq[string]
|
||||
declStructTypeParams*: seq[TypeParam]
|
||||
declStructFields*: seq[StructField]
|
||||
of dkEnum:
|
||||
declEnumName*: string
|
||||
@@ -345,7 +352,7 @@ type
|
||||
declInterfaceMethods*: seq[Decl] ## FuncDecl signatures only
|
||||
of dkImpl:
|
||||
declImplTypeName*: string
|
||||
declImplTypeParams*: seq[string] ## type parameters for generic impl: extend Box<T>
|
||||
declImplTypeParams*: seq[TypeParam] ## type parameters for generic impl: extend Box<T>
|
||||
declImplInterface*: string ## empty if not for interface
|
||||
declImplMethods*: seq[Decl]
|
||||
of dkModule:
|
||||
|
||||
Reference in New Issue
Block a user