Strengthen contract-clause condition diagnostic test coverage - #457
Merged
Conversation
Copilot
AI
changed the title
[WIP] Strengthen contract_clauses_must_be_conditions test
Strengthen contract-clause condition diagnostic test coverage
Jul 29, 2026
onatozmenn
marked this pull request as ready for review
July 29, 2026 20:49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
The
contract_clauses_must_be_conditionstest only assertedTYPE_MISMATCH, which allowed diagnostic wording regressions to slip through. This updates that single test to also assert rendered output contains condition/type expectation language.Scope (single-test change only)
crates/deed-typeck/tests/checking.rs::contract_clauses_must_be_conditionsrendered(&sources, &checked.diagnostics)Guard added
"Bool","condition", or"expected".Why this way
Code-only assertions verify classification, not message quality. This adds a minimal, stable wording guard without overfitting to one exact sentence.
What it still does not do
It does not pin an exact full diagnostic string; it enforces key semantic wording only.
Checks
cargo fmt --checkcargo clippy --workspace --all-targets -- -D warningscargo test --workspacecargo run -p deed-cli -- check examples/andtest examples/, if this touches the compilerdesign/updated in this PR, if this changes behaviour one ofthem describes. A design that lags the code is worse than no design.
guard test that only passes values the guard accepts proves nothing, and that is how
the worst bug here went unnoticed.
AI assistance used.
Original prompt