leanprover / leanprover/lean4

RFC: unused variables linter should lint against unused typeclass arguments

Open
#7,956 1 comment 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P-medium RFC RFC accepted
Dominant language
Lean
Stars
9.2k
Forks
990
Avg merge
1d 17h
Merged PRs (30d)
175

Description

Proposal

The following code does not cause an unused variable warning.

example [Inhabited Nat] : 0 = 0 := rfl

This is a reasonably common defect in the standard library, and it would be great if we had a linter for it. As usual it should be possible the linter by using a construct like [_ : Inhabited Nat].

Impact

Add 👍 to issues you consider important. If others benefit from the changes in this proposal being added, please ask them to add 👍 to it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the unused variables linter and the code that handles typeclass arguments. Reproduce the example with [Inhabited Nat] and compare it with the explicit [_ : Inhabited Nat] form. Done means unused typeclass arguments produce warnings while explicitly named underscore arguments suppress them.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.