Skip to content

prototype #1632.6: say how many arguments a partial call is missing - #1736

Closed
adeerkhan wants to merge 4 commits into
bendlang:mainfrom
adeerkhan:proto/1632-6-missing-argument
Closed

adeerkhan wants to merge 4 commits into
bendlang:mainfrom
adeerkhan:proto/1632-6-missing-argument

Conversation

@adeerkhan

@adeerkhan adeerkhan commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

This is a prototype for proposal 6 of #1632 (a missing argument), in reply to the request to prototype 1–7. It is opened against bendlang/bend for review: bend2/bend.ts is human-written per AGENTS.md, so it is not a merge request as it stands. The branch is proto/1632-6-missing-argument on the fork, 4f702999, rebased on main; the repo gate is green.
Added at check-any's final comparison (bend.ts:3715), the place you named. It fires only when the observed type is a ∀ and the expected type isn't, and the head is a Ref to a Def. "Arguments" counts the def's non-erased domains. A foreign def (an effect operation) is skipped: its continuation is passed by the do block, not written (do_header_typed keeps its old output), and a template is skipped, its ~ arguments being erased in the type but written at the call.

Your repro:

SOME PROOFS FAIL
Error:
- expected : U32
- observed : @b:U32 -> U32
Location: main
6 | def main() -> U32:
7>|   add2(1)
  |   ^^^^^^^
8 | 
Note: add2 takes 2 arguments, 1 given (missing b : U32).

A bare add2 gets all of them:

SOME PROOFS FAIL
Error:
- expected : U32
- observed : @a:U32 -> @b:U32 -> U32
Location: main
6 | def main() -> U32:
7>|   add2
  |   ^^^^
8 | 
Note: add2 takes 2 arguments, 0 given (missing a : U32, b : U32).

tests/parse/glued_bracket.bend (an erased type parameter, id2) gains Note: id2 takes 1 argument, 0 given (missing x : A).; tests/check/partial_call_arity.bend and tests/check/higher_order_arity.bend pin the two cases.

@nicolas-abril

Copy link
Copy Markdown
Collaborator

Thanks for the prototype. Closing in favor of #2008, which does this in a smaller form to save tokens in bend.ts.

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.

2 participants