feat: generic methods on generic structs + method call auto-addressing
- Auto-register func Type_Method<T>(self: *Type<T>) as methods in sema - Add type param awareness to sema resolveType for generic function bodies - Add lazy monomorphization for generic struct method calls in HIR lowering - Track varTypeExprs in LowerCtx for local variable type inference - Fix ekSelf in both sema and hir_lower to resolve actual parameter type - Fix lowerFunc to use substituteType for param/return types (handles pointers to generic structs) - Auto-address value receivers when method expects pointer (e.g., b.Get() where self: *Box<T>) - Add C forward declarations for all functions to fix ordering issues - Relax type checks for tkTypeParam in assignments and arguments - Update generics_struct example with Box_Get, Box_Set, Pair_GetFirst/Second
This commit is contained in:
@@ -114,6 +114,7 @@ proc `!=`*(a, b: Type): bool = not (a == b)
|
||||
# Assignment compatibility
|
||||
proc isAssignableTo*(a, b: Type): bool =
|
||||
if a.isUnknown or b.isUnknown: return true
|
||||
if b.kind == tkTypeParam: return true
|
||||
if a == b: return true
|
||||
# float32 -> float64
|
||||
if a.kind == tkFloat32 and b.kind == tkFloat64: return true
|
||||
|
||||
Reference in New Issue
Block a user