Skip to content

Type a trait method call by the resolved impl method's type - #339

Open
coord-e wants to merge 1 commit into
mainfrom
claude/gifted-bohr-dbi6zt
Open

coord-e wants to merge 1 commit into
mainfrom
claude/gifted-bohr-dbi6zt

Conversation

@coord-e

@coord-e coord-e commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Fixes #337

fn_def_ty typed a trait method call with the trait method's own type whenever it had one. For a trait method with a default body, that type comes from the default body. When the call resolved to an override annotated with its own spec (#[thrust::callable]), the override was checked only against that spec. Callers still assumed the default body's postcondition, so assert!(A.m() == 2) verified even though the override returns 1.

The call is now typed by the resolved impl method's type whenever that method has one. For an unannotated override that type is trait_item_ty, i.e. the trait method's type, so nothing changes there. For an annotated override it is the spec the body is actually checked against.

Added tests/ui/{pass,fail}/trait_default_override_callable.rs. The fail case verified as safe before this change. cargo test passes: 402 UI tests, run with the pinned Z3 and PCSat.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SHVtHJd3xtzyFQiUiyqD3m


Generated by Claude Code

A call to a trait method with a default body was typed by the trait
method's type, which is inferred from the default body, even when it
resolved to an override annotated with its own spec. The override is
checked only against that spec, so callers assumed a postcondition
nobody proved. Use the resolved impl method's type when there is one;
an unannotated override's type is the trait method's type anyway.

Fixes #337

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SHVtHJd3xtzyFQiUiyqD3m
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T21:50:57.321087Z ad9d792 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants