feat: split ControlInfo.noFallthrough from syntactic numRegularExits#13502
Merged
Conversation
|
Mathlib CI status (docs):
|
Collaborator
|
Reference manual CI status:
|
This PR splits `ControlInfo`'s dead-code signal in two. `numRegularExits` is now purely syntactic: the number of times the block wires its continuation into its elaborated expression, consumed by `withDuplicableCont` as a join-point duplication trigger (`> 1`). The new `noFallthrough : Bool` asserts that the next doElem in the enclosing sequence is semantically irrelevant; `false` asserts nothing. Invariant: `numRegularExits = 0 → noFallthrough`; the converse does not hold. `sequence` derives `noFallthrough` as `a.noFallthrough || b.noFallthrough` (and aggregates syntactic fields unconditionally); `alternative` derives it as `a.noFallthrough && b.noFallthrough`. The dead-code warning gate in `withDuplicableCont` and `ControlLifter.ofCont` now reads `noFallthrough`.
2828b31 to
767f84f
Compare
ControlInfo.exitsDead from syntactic numRegularExitsControlInfo.noFallthrough from syntactic numRegularExits
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.
This PR splits
ControlInfo's dead-code signal in two.numRegularExitsis now purely syntactic: how many times the block wires its continuation into the elaborated expression, consumed bywithDuplicableContas a join-point duplication trigger (> 1). The newnoFallthrough : Boolasserts that the next doElem in the enclosing sequence is semantically irrelevant;falseasserts nothing. Invariant:numRegularExits = 0 → noFallthrough; the converse does not hold.sequencederivesnoFallthrough := a.noFallthrough || b.noFallthrough(and aggregates syntactic fields unconditionally);alternativederives it asa.noFallthrough && b.noFallthrough. The dead-code warning gate inwithDuplicableContandControlLifter.ofContnow readsnoFallthrough.