typechecker loop: disable OZ_Math directional summary when Math.Rounding is unresolvable#99
Open
jar-ben wants to merge 2 commits into
Open
typechecker loop: disable OZ_Math directional summary when Math.Rounding is unresolvable#99jar-ben wants to merge 2 commits into
jar-ben wants to merge 2 commits into
Conversation
…ing is unresolvable
shellygr
reviewed
Jul 24, 2026
| disabled_fns.add(m.group(1)) | ||
| if disabled_fns: | ||
| for i, line in enumerate(lines): | ||
| if "=>" in line and any(fn in line for fn in disabled_fns): |
Contributor
There was a problem hiding this comment.
it probably happens in other functions but it's odd not to use the AST here too
shellygr
approved these changes
Jul 24, 2026
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.
Problem
The scene-based OZ Math summary (
OZ_Math-<Contract>.spec) emits an active directionalmulDivsummary that references theMath.Roundingenum type:Roundingis declared in the OZMathlibrary. In scenes where that library is inlined /duplicated across compilation units,
Math.Roundingis not a usable CVL enum type and nocontract re-declares it, so the typechecker rejects the reference:
Crucially this error carries no
Did you meansuggestion (there is no valid alternativequalifier), so the loop's existing ambiguous-Rounding requalification path has nothing to act
on. The generated spec fails to typecheck, breaking setup for the affected project.
Fix
Teach the typechecker loop to recognize and recover from this case
(
certora_autosetup/typechecker_loop.py):X.Rounding is not a valid enum typeerroras
ROUNDING_UNRESOLVABLE(kept distinct from the requalifiableROUNDING_AMBIGUOUScase,which always carries suggestions).
the existing AST-range block expansion, so a partially-commented function never remains) plus
the
methods{}entries that dispatch to those functions.The recovery runs only when the typechecker offers no requalification, so scenes where
Math.Rounding— or a contract-qualifiedC.Rounding— does resolve are unchanged and keep thedirectional summary.
Testing
tests/test_typechecker_rounding_fix.py— added coverage: parsing the unresolvable error,guarding it against mis-classification as the ambiguous case (both directions), and the
disable-directional callback. Full file: 12 passed.
tests/test_oz_math_rounding_unit.py— 19 passed (module untouched).certoraRun --compilation_steps_onlypasses after the fix (certora-cli-beta 8.18.0).🤖 Generated with Claude Code