Skip to content

Take the type of a call from the callee - #227

Draft
coord-e wants to merge 1 commit into
claude/entry-precondition-from-signaturefrom
claude/call-type-from-callee
Draft

Take the type of a call from the callee#227
coord-e wants to merge 1 commit into
claude/entry-precondition-from-signaturefrom
claude/call-type-from-callee

Conversation

@coord-e

@coord-e coord-e commented Aug 16, 2026

Copy link
Copy Markdown
Owner

Second of three, on top of #226. Each removes one predicate variable that stood for a fact the constraints already state elsewhere.

A call bound its result to a template and related the return type of the callee to it by subtyping. The callee already says everything known about its result, so its return type is instantiated at the arguments and bound directly (instantiate_return_type).

Adapting the arguments to the parameter list of the callee moves out into adapt_args_to_abi and now works on PlaceTypes. That lets a rust-call tuple be untupled by projection instead of by rewriting refinements, and keeps the arguments as terms, so no variable stands between a call and its result.

Effect

Over tests/ui/pass (160 files), predicate variables generated: 1293 → 734, the largest of the three steps — a call site is the most common place we were naming something already known.

Notes for review

  • The hardest hunk is adapt_args_to_abi: the rust-call expansion both moved and was rewritten, so git shows it as a delete plus an add rather than a move.
  • Passing the arguments as terms rather than as variables of the environment is not cosmetic. An earlier draft bound each argument to a variable and substituted that; the extra indirection was enough that pcsat stopped solving tests/ui/pass/closure_receiver_mut_model_byval.rs (the system stayed satisfiable — eliminating the trivial equalities from the generated .smt2 by hand made it sat again).
  • This predicate variable also served as a cut point for the solver, and removing it alone is not free: on top of main rather than Take the precondition of the entry block from the signature #226, z3 needs far longer than its timeout on tests/ui/pass/mut_recursive.rs. With the entry block having given up its own predicate variable first, it stays at ~0.3s.

316 tests pass.


Generated by Claude Code

A call bound its result to a template, and the return type of the callee
was related to it by subtyping, leaving a predicate variable to be
inferred for what the callee already states. Instantiate the return type
of the callee at the arguments and bind that instead.

Adapting the arguments to the parameter list of the callee now works on
`PlaceType`s, which lets a `rust-call` tuple be untupled by projection
rather than by rewriting refinements, and keeps the arguments as terms so
that no variable stands between a call and its result.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P7MyQbvfkfNy1h7yeN553N
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