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

Spurious linter warning "unused variable" #2830

Closed
PratherConid opened this issue Nov 6, 2023 · 1 comment · Fixed by #5337
Closed

Spurious linter warning "unused variable" #2830

PratherConid opened this issue Nov 6, 2023 · 1 comment · Fixed by #5337
Labels
bug Something isn't working

Comments

@PratherConid
Copy link

PratherConid commented Nov 6, 2023

Steps to Reproduce

inductive Foo : (Nat → Nat) × Nat × Nat → Type
  | ctor (n : Nat) : Foo ⟨lctx, n, lctx n⟩

def bar (wft : Foo ⟨lctx, n, s⟩) : True :=
  match wft with
  | .ctor _ => True.intro -- unused variable `n` [linter.unusedVariables]

def bar' (wft : Foo ⟨lctx, n, s⟩) : True :=
  match n, wft with
  | _, .ctor _ => True.intro -- unused variable `s` [linter.unusedVariables]

Versions

Lean (version 4.3.0-rc1, commit baa4b68, Release)
Ubuntu 20.04.6 LTS (WSL)

@PratherConid PratherConid added the bug Something isn't working label Nov 6, 2023
@marcusrossel
Copy link
Contributor

marcusrossel commented Jan 18, 2024

I think here's the same problem but a simpler example:

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

github-merge-queue bot pushed a commit that referenced this issue Sep 13, 2024
Fixes an unused variable false positive on some wildcard patterns

Fixes #1633, fixes #2830
@Kha Kha closed this as completed in #5337 Sep 13, 2024
tobiasgrosser pushed a commit to opencompl/lean4 that referenced this issue Sep 16, 2024
Fixes an unused variable false positive on some wildcard patterns

Fixes leanprover#1633, fixes leanprover#2830
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants