Type switch scrutinee bindings by their enumeration type - #233
Draft
nikswamy wants to merge 1 commit into
Draft
Conversation
Clang applies the integral promotions to a switch condition, so the translated condition carries the promoted integer type. An enumeration is modeled by its underlying integer type, which makes that promotion the identity, so the rvalue translation elides it. The scrutinee binding was still annotated with the promoted type, leaving the declared type and the bound value syntactically distinct. The Pulse dereference tactic compares types syntactically and rejected the binding. Annotate the binding with the enumeration's own type when the unpromoted condition is an enumeration. Other promotions remain genuine casts that the rvalue translation preserves, so their promoted type is still correct. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 981f7d3c-6a91-47ad-84d7-7aadf747123d (cherry picked from commit 588982d)
Contributor
|
!diff |
Generated F* output diffEffect of this pull request on the F* code ✅ The generated output is unchanged. |
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.
Part of the upstreaming of
nswamy/pal-c-project-integration(PR19 of 35 PRs) — seePR_PLAN.mdon that branch for the whole plan and the dependency graph.Base:
main. Depends on nothing; reviewable on its own.Clang promotes a switch condition, and an enumeration modeled by its underlying integer
type makes that promotion the identity, which the rvalue translation elides — but the
scrutinee binding was still annotated with the promoted type, so the declared type and the
bound value were syntactically distinct and Pulse's dereference tactic, which compares
syntactically, rejected the binding. Other promotions are genuine casts and keep their
promoted type.
Commits
Testing
No test directory of its own — this is an enabler whose effect shows up in another PR's fixture, a
pulse/library lemma, or atests-todoreproducer. Verified with a fullmake test -j8(1372 modules, 0 errors) to confirm it regresses nothing.