fix(units): inherit units through alias chains, source-render if/match/struct diagnostics, drop stale report.json on type errors - #542
Merged
Conversation
…t exprs in diagnostics, drop stale report.json on type errors Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
AkiraTamai
marked this pull request as ready for review
September 2, 2026 13:58
…r cannot surface an earlier atom's report Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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.
Summary
Follow-up to #539/#541 for three issues found while testing the units checker via the CLI on
develop.1. Alias-of-alias lost its unit (bug).
type Money = Usd;hadunit: None, som: Money + j: Jpyverified. NewModuleEnv::unit_of_type(name)walks_base_typeuntil aunittag is found (cycle-safe);units.rsand the proof cache both use it.The cache hash now includes
name:base=unitfor every alias that resolves to a unit, so re-pointingtype B = A;totype B = J;invalidates cached results (unitless modules hash exactly as before).2. AST
Debugin unit diagnostics (cosmetic).expr_to_source_stringfell back to{:?}forIfThenElse/Match/StructInit, producingIfThenElse { cond: Variable("c"), then_branch: Block([...]) ... }. Added source rendering:if c { A { amt: u } } else { B { amt: j } },match x { Some(v) => { v }, _ => { 0 } }.3.
--jsonpolluted by stalereport.json(existing behavior, but unit errors make it easy to hit). Atoms rejected before Z3 (type/unit errors) never writereport.json; the--jsonpath then reads whatever file was left by a previous run and emits its top-level fields ("status":"success","atom":..., "span":...) next to exit code 1. Fix:cmd_verifyremoves<report-dir>/report.jsonat start, so only this run's output can be read back. Also, type errors were taggedz3_sat(viaz3_result_from_error_message(..).unwrap_or("sat")) although Z3 never ran; they are now taggedz3_skipped, same as unverifiable atoms. No Z3 encoding, MIR, or runtime changes.Tests:
tests/test_units.rsgains alias-chain positive/negative fixtures, an alias re-pointing cache-invalidation case, source-rendering assertions on the branch-mismatch fixtures, and a stale-report.json--jsonregression.docs/LANGUAGE.mdnotes alias inheritance.Link to Devin session: https://app.devin.ai/sessions/2eef5afcd69d4e0ab19ada3b22d5cf7e
Open in Devin Desktop: https://app.devin.ai/desktop/session/2eef5afcd69d4e0ab19ada3b22d5cf7e?variant=devin
Requested by: @AkiraTamai