Repository navigation
Conversation
…ranch
`check_if` typed an `if`/`else` by its `else` branch. When that branch
diverged (`return`, `continue`, `break`) the whole conditional became `!`,
even if the `then` branch fell through, e.g. the inner `if` of
`if a { return 1 } else if b { r = 3 } else { return 2 }`. Lowering then
treated the join after the chain as unreachable and replaced the following
statements with an unreachable-code trap, so a loop like
while i < 4 {
if i != 1 { i += 1; continue } else if i == 1 { } else { return 100 }
i += 2
}
reverted on the EVM and trapped natively. `check_match` had the same
problem for a last arm that diverges.
The divergence of a branch was also lost earlier: `equate_ty` answered a
diverging expression with the expected type even while that was still an
open type variable. It now keeps `!` in that case, `check_if` uses the type
of a branch that doesn't diverge, and `check_match` only becomes `!` when
every arm diverges.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This branch has not been deployed
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.
…ranch
check_iftyped anif/elseby itselsebranch. When that branch diverged (return,continue,break) the whole conditional became!, even if thethenbranch fell through, e.g. the innerifofif a { return 1 } else if b { r = 3 } else { return 2 }. Lowering then treated the join after the chain as unreachable and replaced the following statements with an unreachable-code trap, so a loop likereverted on the EVM and trapped natively.
check_matchhad the same problem for a last arm that diverges.The divergence of a branch was also lost earlier:
equate_tyanswered a diverging expression with the expected type even while that was still an open type variable. It now keeps!in that case,check_ifuses the type of a branch that doesn't diverge, andcheck_matchonly becomes!when every arm diverges.