Skip to content

[AI Pasta] [main] Run overloaded calls once and retain their type alternatives - #314

Open
godelclaw wants to merge 2 commits into
trueagi-io:mainfrom
godelclaw:fix/typed-call-once-main-20261107
Open

godelclaw wants to merge 2 commits into
trueagi-io:mainfrom
godelclaw:fix/typed-call-once-main-20261107

Conversation

@godelclaw

@godelclaw godelclaw commented Nov 8, 2026 •

Copy link
Copy Markdown

When several declarations survive a call, main emits a guarded body call for each one. This repeats answers and side effects. Dispatch now runs the body once for the argument values and retains each result accepted by a compatible declaration.

Open values carry disjunctive requirements before the body runs; output checks refine the surviving alternatives afterward. Requirements follow aliases and newly exposed subterms. An overload that rejects the result leaves no unrelated input constraint behind.

Equivalent final input-only obligations can be reused on the same actual variables. Caller-owned type variables remain rigid. The translator identifies its fresh declaration variables so their renaming can be ignored when comparing input-only requirements. Pending output states keep separate identities. Comparison copies do not alter the live values or their obligations.

Validation on upstream main ee5cacb plus this change:

  • Full suite: 333 ordinary examples, 167 expected-rejection examples, seven matrices and 151 unit passes.
  • Fixed-branch integration preview: 338 ordinary examples, 168 expected-rejection examples, seven matrices and 216 unit passes.
  • The expanded example passes 31 assertions. Nine new tests cover private/shared type variables, pending states, copying and rollback; the translated-call reuse regression fails before the follow-up repair.
  • 119 independent lifecycle controls pass on candidate and preview.
  • Repeated primitive and polymorphic input-only calls retain one requirement in the scaling probes; 400 calls take about 18k and 30k inferences respectively.

Both full suites retain the existing tilepuzzle --oracle timeout skip. Targeted SWI -O checks pass but retain main's existing builtin-registry startup diagnostic (also addressed by #298). Normal-mode full suites are the primary validation here. Type checking still has runtime and memory costs; no universal speedup is claimed.

Fixes #312. Companion stable change: #313.

Oruzi and others added 2 commits November 8, 2026 13:17
When several declarations survived for a call, each became a branch with its
own guards and call, so a call that more than one declaration accepted ran
its body once per declaration, duplicating answers and effects. Now the
first declaration whose guards accept the arguments runs the call, and a
result is kept if that declaration, or a later declaration accepting the
arguments, accepts it; when arguments or results are still open, only the
overloads that accept the post-call tuple attach residual constraints. A
call no declaration accepts still raises no_matching_overload.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

Typed calls can execute once per accepting declaration or type witness

1 participant