Skip to content

selfhost: add AST-aware overload candidate selector - #722

Merged
godofecht merged 3 commits into
mainfrom
selfhost/overload-select-core
Aug 23, 2026
Merged

godofecht merged 3 commits into
mainfrom
selfhost/overload-select-core

Conversation

@godofecht

@godofecht godofecht commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Continues #677 on top of #717.

Adds compiler/src/overload_select.flow, the pure selection layer between the native multi-signature table (#713) and TcCtx integration. It normalizes each candidate parameter with #717, applies #709 ordinary compatibility followed by unsuffixed-integer widening, and distinguishes unique selection from known no-match, genuine ambiguity, and unresolved multi-candidate calls whose argument/parameter type is not yet inferable. A sole same-name/arity candidate preserves the production resolver's unknown-type fallback instead of manufacturing a false type error.

Also adds compiler/src/overload_args.flow, which converts an AST call argument chain into normalized type rows, known/unknown flags and unsuffixed-integer markers. TcCtx supplies only identifier binding type-node IDs; literals, struct literals and casts are classified natively, with composite casts using #717 directly.

Tests cover ordinary selection, u32 literal widening, widening ambiguity, sole-overload unknown fallback, unresolved multiple candidates, known no-match, literal/identifier classification, composite-cast normalization and unknown identifiers.

This PR intentionally does not mutate TcCtx yet. Once #717 and this core are qualified, the final #677 integration is limited to overload-table lifecycle/population in typecheck.flow, identifier type-node lookup for AST_CALL arguments, invocation of these adapters, and diagnostics from the selector outcome.

Related: #674 #677 #713 #715 #717 #718 #720

@godofecht
godofecht force-pushed the selfhost/overload-select-core branch from 80421d8 to a260403 Compare August 23, 2026 11:01
@godofecht
godofecht marked this pull request as ready for review August 23, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant