leanprover / leanprover/lean4

Linter for macros

Open
#180 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

The linter should report problems such as:

macro "foo!" x:term y:term : term => `($x + $y)

#check foo! 10 20

#check 10 -- we get 'expect term' error at `#check`

The macro foo! is accepted, but we get an error when we use it, and the error "expected term" is reported at #check 10. Issue: 10 20 is parsed as (10 20) because of the app parser. So, any macro containing two consecutive term arguments with precedence < max in the first argument produces this error. The linter should suggest the user include the max precedence at x:term.

macro "foo!" x:term:max y:term : term => `($x + $y)

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 with the linter and the app parser behavior described in the issue, using the foo! macro examples to reproduce the error. The work is done when the linter identifies consecutive term arguments where the first has precedence below max and suggests adding :max to that argument; no file or test is named.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.