leanprover / leanprover/lean4

`deprecated` linter triggered by unrelated local variable names

Open
#2,132 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Prerequisites
  • Put an X between the brackets on this line if you have done all of the following:
    • Checked that your issue isn't already filed.
    • Reduced the issue to a self-contained, reproducible test case.
Description

The deprecated linter triggers on local variable names that are identical with the name of a deprecated definition when using the let syntax with pattern matching.

Steps to Reproduce

Use the following code to reproduce the issue:

@[deprecated True]
def test := True

#eval Id.run do
  let (test, _) := (0,0) -- `test` has been deprecated, use `True` instead
  test

Note that the variable test in the #eval command does not refer to the definition above at all.

Expected behavior: No linter warning since the global definition test is not used.

Actual behavior: I get a linter warning on the variable test in let (test, _) := (0,0).

Reproduces how often: 100%

Versions

Tested on Lean4 nightly-2023-02-24

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 running the supplied Lean reproduction using the deprecated attribute, #eval, and a let pattern binding. Trace how the deprecated linter resolves names for local pattern variables; the issue names no source file or test path. Done means the local test binding produces no warning while actual uses of the deprecated definition remain diagnosed.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.