Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not lift (<- ...) over pure if-then-else #3820

Merged
merged 2 commits into from
Apr 1, 2024
Merged

Conversation

leodemoura
Copy link
Member

@leodemoura leodemoura commented Apr 1, 2024

Now, only (<- ...)s occurring in the condition of a pure if-then-else are lifted.
That is, if (<- foo) then ... else ... is ok, but if ... then (<- foo) else ... is not. See #3713

closes #3713

This PR also adjusts this repo. Note that some of the (<- ...) were harmless since they were just accessing some
read-only state.

Remark: some of them were harmless since they were accessing some
read-only state.
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc April 1, 2024 21:31 Inactive
@leodemoura leodemoura added this pull request to the merge queue Apr 1, 2024
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Apr 1, 2024
@leanprover-community-mathlib4-bot
Copy link
Collaborator

Mathlib CI status (docs):

  • ❗ Mathlib CI can not be attempted yet, as the nightly-testing-2024-04-01 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-mathlib, Mathlib CI should run now. (2024-04-01 21:36:14)

Merged via the queue into master with commit 0684c95 Apr 1, 2024
12 checks passed
@alexjbest
Copy link
Contributor

Thank you Leo! I got hit by this again recently so I am very happy to see it fixed

Comment on lines -31 to +32
by subst h; exact $(← mkSameCtorRhs todo):term
by subst h; exact $sameCtor:term
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've filed this as #3827, since it also impacts Qq; am I right in thinking that this is tracked by the following TODO?

-- TODO: we must track whether we are inside a quotation or not.
private partial def hasLiftMethod : Syntax → Bool

eric-wieser added a commit to leanprover-community/quote4 that referenced this pull request Apr 2, 2024
Once it lands in a release, the change in leanprover/lean4#3820 to detect accidental do lifting misfires on quotations.
To avoid breakage later, we manually lift out this expression.
semorrison pushed a commit to leanprover-community/quote4 that referenced this pull request Apr 2, 2024
Once it lands in a release, the change in leanprover/lean4#3820 to detect accidental do lifting misfires on quotations.
To avoid breakage later, we manually lift out this expression.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

<- lifting over if produces incorrect code
4 participants