You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Self-Hosting Phase 1] Port Function Overload Resolution by Signature to Flow #677
Implementation note after #709: the next blocker is in Stage-A TcCtx, not the matching predicates. Today the name table stores ns/ne/nk/na, where na is a single arity for function bindings, and flowc_tc_lookup_fn_arity walks backward and returns the first same-name function. The next increment should therefore extend the native function binding metadata to retain one entry per signature (parameter type-node chain + arity), gather all same-name/arity candidates at an AST_CALL, apply the #709 two-phase matcher across argument types, then report 0/1/>1 as missing/unique/ambiguous. That is the path to the actual multi-signature symbol-table and ambiguity deliverables; merely changing lookup order would be wrong.
Further integration finding: Stage-A flowc_tc_check_expr currently validates calls by name + a single flowc_tc_lookup_fn_arity; it does not compute a reusable expression type for call arguments. So after the #713 multi-signature table lands, candidate selection needs a small native argument-type inference layer first (at minimum literals, bound identifiers via flowc_tc_lookup_val_type, casts, struct literals, and obvious array/span forms). Then AST_CALL can enumerate same-name/arity decls and apply #709. Trying to wire #709 directly into today's call checker would duplicate or guess type inference.
selfhost: add minimal expression type classifier for overloads #715: expr_type.flow provides the minimal deterministic argument classifier needed by overload selection: literals, known identifier bindings, plain casts, struct literals, plus the unsuffixed-int-literal marker. Unknown/composite cases remain unknown rather than guessed.
Once #713/#715 land, the next integration patch can be surgical: populate the table in flowc_tc_bind_globals; at AST_CALL obtain known identifier type names from TcCtx, classify each argument, enumerate same-name/arity declarations, compare their parameter AST_TYPE spans using #709 compatibility/widening policy, and emit ambiguity/no-match diagnostics. Cross-module overload signatures remain a separate portability problem because foreign AST node ids cannot be stored in the local table.
Progress update on native overload resolution: #713 is merged (multi-signature same-name/arity table), #715 is merged (minimal Stage-A expression type classifier + integer-literal widening marker), and #717 is in final qualification for byte-exact AST_TYPE canonical names. #717's self-host/no-Python path is already green; its strict-corpus failure was narrowed to mutation of an immutable helper parameter and fixed at c1a931c. Explicit span mutability loss is tracked separately in #718, and reference-span canonicalization in #720, so neither semantic hole is being silently collapsed. Once #717 lands, the next patch is the direct TcCtx integration: register local overload declarations during global collection, classify/normalize AST_CALL arguments, run the #709 matching policy across #713 candidates, and report ambiguous/no-match calls while preserving the existing unknown-type sole-overload fallback.
Progress update (25 Aug 2026): #717 and #722 are merged. Draft #767 now isolates the remaining call-site plumbing into two small native APIs: overload_call.flow owns argument scratch/classification + selector invocation, and overload_registry.flow owns local function-table population/reset. All commits use [skip ci] and are intended for local qualification only.
After #767, the final typecheck.flow integration is reduced to: own/init/free/reset FlowcOverloadTable; collect local declarations once per module; map AST_IDENT call args through existing flowc_tc_lookup_val_type; invoke flowc_overload_resolve_call; diagnose genuine AMBIGUOUS and known NO_MATCH; preserve UNKNOWN, intrinsics, imports, local callable values and extern fallbacks. Codegen unification remains tracked separately by #725.
Progress update: native overload binding now consumes declared identifier/cast types in addition to literals, records a selected AST_FN on AST_CALL, and cgen uses that semantic binding. Added typed-identifier regression coverage; the native/MLIR/effects suite is 60/60 and bootstrap/self-host convergence is green. Cross-module signature tables and full resolver parity remain open.
Validation update: the latest native overload binding passes the full strict language corpus (106/106), including test_unsigned_ints, test_generics, test_effects, test_spans, and test_function_as_value. Bootstrap fixed-point and self_host_full also pass. Cross-module overload signature transport remains the next unresolved scope.
Native cross-module overload parity advanced: imported overloads now select by argument type in the bundled C path, with regression coverage for i32/f32 calls (choose_i32, choose_f32). Native duration/unit lowering was also covered alongside the self-host suite. Focused native overload/duration tests pass.
Completion audit (24 Sep 2026): the stated Phase-1 overload deliverables are now present on main. Native Stage-A retains multiple same-name signatures, resolves exact/typed and unsuffixed-integer widening calls, reports ambiguity/no-match, records/consumes semantic selections in the strict path, and imported overloads have i32/f32 bundle coverage. The recorded qualification includes the full strict language corpus (106/106), bootstrap fixed-point and self_host_full; test_unsigned_ints is included in that strict corpus. The remaining no-typecheck/codegen compatibility resolver is deliberately separate scope under #725 rather than a blocker for this type-system port. Closing #677 as completed; continue resolver/codegen unification in #725.
Activity
godofecht commentedon Aug 22, 2026
Implementation note after #709: the next blocker is in Stage-A
TcCtx, not the matching predicates. Today the name table storesns/ne/nk/na, wherenais a single arity for function bindings, andflowc_tc_lookup_fn_aritywalks backward and returns the first same-name function. The next increment should therefore extend the native function binding metadata to retain one entry per signature (parameter type-node chain + arity), gather all same-name/arity candidates at anAST_CALL, apply the #709 two-phase matcher across argument types, then report 0/1/>1 as missing/unique/ambiguous. That is the path to the actual multi-signature symbol-table and ambiguity deliverables; merely changing lookup order would be wrong.godofecht commentedon Aug 22, 2026
Further integration finding: Stage-A
flowc_tc_check_exprcurrently validates calls by name + a singleflowc_tc_lookup_fn_arity; it does not compute a reusable expression type for call arguments. So after the #713 multi-signature table lands, candidate selection needs a small native argument-type inference layer first (at minimum literals, bound identifiers viaflowc_tc_lookup_val_type, casts, struct literals, and obvious array/span forms). ThenAST_CALLcan enumerate same-name/arity decls and apply #709. Trying to wire #709 directly into today's call checker would duplicate or guess type inference.godofecht commentedon Aug 22, 2026
Post-#709 overload work is now split into concrete native layers rather than a monolithic
typecheck.flowrewrite:overload_table.flowretains every local same-name/arity AST_FN declaration and exposes candidate enumeration. Refreshed onto merged selfhost: port Physics DSL parser primitives to Flow #710; no-Python fixed-point is green on the combined head.expr_type.flowprovides the minimal deterministic argument classifier needed by overload selection: literals, known identifier bindings, plain casts, struct literals, plus the unsuffixed-int-literal marker. Unknown/composite cases remain unknown rather than guessed.Once #713/#715 land, the next integration patch can be surgical: populate the table in
flowc_tc_bind_globals; at AST_CALL obtain known identifier type names from TcCtx, classify each argument, enumerate same-name/arity declarations, compare their parameter AST_TYPE spans using #709 compatibility/widening policy, and emit ambiguity/no-match diagnostics. Cross-module overload signatures remain a separate portability problem because foreign AST node ids cannot be stored in the local table.godofecht commentedon Aug 22, 2026
Progress update on native overload resolution: #713 is merged (multi-signature same-name/arity table), #715 is merged (minimal Stage-A expression type classifier + integer-literal widening marker), and #717 is in final qualification for byte-exact AST_TYPE canonical names. #717's self-host/no-Python path is already green; its strict-corpus failure was narrowed to mutation of an immutable helper parameter and fixed at c1a931c. Explicit span mutability loss is tracked separately in #718, and reference-span canonicalization in #720, so neither semantic hole is being silently collapsed. Once #717 lands, the next patch is the direct TcCtx integration: register local overload declarations during global collection, classify/normalize AST_CALL arguments, run the #709 matching policy across #713 candidates, and report ambiguous/no-match calls while preserving the existing unknown-type sole-overload fallback.
godofecht commentedon Aug 25, 2026
Progress update (25 Aug 2026): #717 and #722 are merged. Draft #767 now isolates the remaining call-site plumbing into two small native APIs:
overload_call.flowowns argument scratch/classification + selector invocation, andoverload_registry.flowowns local function-table population/reset. All commits use[skip ci]and are intended for local qualification only.After #767, the final
typecheck.flowintegration is reduced to: own/init/free/resetFlowcOverloadTable; collect local declarations once per module; map AST_IDENT call args through existingflowc_tc_lookup_val_type; invokeflowc_overload_resolve_call; diagnose genuineAMBIGUOUSand knownNO_MATCH; preserveUNKNOWN, intrinsics, imports, local callable values and extern fallbacks. Codegen unification remains tracked separately by #725.godofecht commentedon Sep 16, 2026
Progress update: native overload binding now consumes declared identifier/cast types in addition to literals, records a selected AST_FN on AST_CALL, and cgen uses that semantic binding. Added typed-identifier regression coverage; the native/MLIR/effects suite is 60/60 and bootstrap/self-host convergence is green. Cross-module signature tables and full resolver parity remain open.
godofecht commentedon Sep 16, 2026
Validation update: the latest native overload binding passes the full strict language corpus (106/106), including test_unsigned_ints, test_generics, test_effects, test_spans, and test_function_as_value. Bootstrap fixed-point and self_host_full also pass. Cross-module overload signature transport remains the next unresolved scope.
godofecht commentedon Sep 16, 2026
Native cross-module overload parity advanced: imported overloads now select by argument type in the bundled C path, with regression coverage for i32/f32 calls (
choose_i32,choose_f32). Native duration/unit lowering was also covered alongside the self-host suite. Focused native overload/duration tests pass.godofecht commentedon Sep 24, 2026
Completion audit (24 Sep 2026): the stated Phase-1 overload deliverables are now present on
main. Native Stage-A retains multiple same-name signatures, resolves exact/typed and unsuffixed-integer widening calls, reports ambiguity/no-match, records/consumes semantic selections in the strict path, and imported overloads have i32/f32 bundle coverage. The recorded qualification includes the full strict language corpus (106/106), bootstrap fixed-point andself_host_full;test_unsigned_intsis included in that strict corpus. The remaining no-typecheck/codegen compatibility resolver is deliberately separate scope under #725 rather than a blocker for this type-system port. Closing #677 as completed; continue resolver/codegen unification in #725.