Skip to content

Commit

Permalink
fix: inaccessible pattern vars reported as binders
Browse files Browse the repository at this point in the history
  • Loading branch information
Kha committed Sep 13, 2024
1 parent 79943be commit c5747f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Lean/Elab/Match.lean
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ where
| .proj _ _ b => return p.updateProj! (← go b)
| .mdata k b =>
if inaccessible? p |>.isSome then
return mkMData k (← withReader (fun _ => false) (go b))
return mkMData k (← withReader (fun _ => true) (go b))
else if let some (stx, p) := patternWithRef? p then
Elab.withInfoContext' (go p) fun p => do
/- If `p` is a free variable and we are not inside of an "inaccessible" pattern, this `p` is a binder. -/
Expand Down
4 changes: 4 additions & 0 deletions tests/lean/linterUnusedVariables.lean
Original file line number Diff line number Diff line change
Expand Up @@ -266,3 +266,7 @@ def A.out : A → Nat
theorem problematicAlias (n : A) (i : Nat) (h : i ≤ n.out) : i ≤ n.out :=
match n with
| .intro _ => by assumption

example : (x = y) → y = x
| .refl _ => .refl _
--^ unused variable 'x'

0 comments on commit c5747f1

Please sign in to comment.