saw-central: Compare Tys in TypeShapes using checkCompatibleTys, not Eq #3059
Merged
RyanGlScott merged 2 commits intomasterfrom Feb 20, 2026
Merged
Conversation
Refactoring only, NFCI. Towards #3055.
The `Eq` class compares MIR types for syntactic equality, but for the reasons described in #1976, this is too fine-grained a notion of equality to be suitable for SAW purposes. Instead, we now use `checkCompatibleTys`, which intentionally equates types such as `i32` and `u32`. The upshot to this is that SAW will now no longer spuriously reject `mir_array_value`s that use a signed integer type (e.g., `mir_i32`) as the element type. This is because these elements will be converted to SAW `Term`s with the Cryptol type `[32]`, which would then be converted to MIR values of type `u32`. The `checkCompatibleTys` function ensures that `i32` and `u32` are then treated as compatible types. Fixes #3055.
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.
The
Eqclass compares MIR types for syntactic equality, but for the reasons described in #1976, this is too fine-grained a notion of equality to be suitable for SAW purposes. Instead, we now usecheckCompatibleTys, which intentionally equates types such asi32andu32.The upshot to this is that SAW will now no longer spuriously reject
mir_array_values that use a signed integer type (e.g.,mir_i32) as the element type. This is because these elements will be converted to SAWTerms with the Cryptol type[32], which would then be converted to MIR values of typeu32. ThecheckCompatibleTysfunction ensures thati32andu32are then treated as compatible types.Fixes #3055.