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: use correct expr positions when delaborating match patterns #4034

Merged
merged 3 commits into from
May 1, 2024

Conversation

kmill
Copy link
Collaborator

@kmill kmill commented Apr 30, 2024

In the following, hovering over true in the infoview was showing Nat.succ y.

#check fun (x : Nat) =>
  match h : x with
  | 0 => false
  | y + 1 => true

Now hovering over true shows true.

The issue was that SubExpr positions were not being tracked for patterns, and the position for a pattern could coincide with the position for a RHS, putting overwriting terminfo. Now the position given to a pattern is correct and unique.

Refactors the match delaborator, makes it handle shadowing of h : discriminant annotations correctly, and makes it use the standard withOverApp combinator to handle overapplication.

In the following, hovering over `true` in the infoview was showing `Nat.succ y`.
```lean
#check fun (x : Nat) =>
  match h : x with
  | 0 => false
  | y + 1 => true
```
Now hovering over `true` shows `true`.

The issue was that SubExpr positions were not being tracked for patterns and the position for a pattern could coincide with the pattern for a RHS. Now the position given to a pattern is an argument to a motive in a minor premise in the type of the head of the match expression.
@kmill kmill requested a review from kim-em as a code owner April 30, 2024 15:02
@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 30, 2024
@leanprover-community-mathlib4-bot
Copy link
Collaborator

Mathlib CI status (docs):

  • ❗ Std/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 6e731b4370000a8e7a5cfb675a7f3d7635d21f58 --onto 1630d9b803164bb522f4a40fbc8fbf104cca425e. (2024-04-30 15:21:09)

kmill added 2 commits April 30, 2024 12:10
properly handle names of "`h :` annotations"
@kmill kmill added this pull request to the merge queue May 1, 2024
Merged via the queue into leanprover:master with commit 359f600 May 1, 2024
15 checks passed
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.

2 participants