mathlib4 icon indicating copy to clipboard operation
mathlib4 copied to clipboard

feat: lint `attribute [instance] instName in`

Open grunweg opened this issue 1 year ago • 2 comments

Contrary to what users would expect, this defines a global instance.

This linter would have caught #13144 and #13170. Zulip discussion

Co-authored by: @adomani


Open in Gitpod

grunweg avatar May 24 '24 23:05 grunweg

I wrote a test yesterday (of course!), but forgot to commit it :facepalm: I've updated it to use your example instance now (and added you as an author of the tests), since this avoid mathlib imports.

grunweg avatar May 25 '24 07:05 grunweg

I just tried the logic you proposed. It works, so I switched to it (and added you an an author). I tweaked one test to consider nested syntax (which worked), so I guess attributes are always the first syntax.

grunweg avatar May 25 '24 07:05 grunweg

!bench

grunweg avatar May 25 '24 20:05 grunweg

Here are the benchmark results for commit 627bf3ad22c5bc22738e391fcc2e8f85ff6dfc8d. There were no significant changes against commit 49e1c29de1b78922c62e6e0cd04280bc742897f6.

leanprover-bot avatar May 25 '24 20:05 leanprover-bot

Two minor requests, otherwise

bors d+

kim-em avatar May 26 '24 09:05 kim-em

:v: grunweg can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

mathlib-bors[bot] avatar May 26 '24 09:05 mathlib-bors[bot]

Thanks for the fast review. bors r+

grunweg avatar May 26 '24 10:05 grunweg

Build failed:

mathlib-bors[bot] avatar May 26 '24 11:05 mathlib-bors[bot]

bors r+

grunweg avatar May 26 '24 12:05 grunweg

Pull request successfully merged into master.

Build succeeded:

mathlib-bors[bot] avatar May 26 '24 14:05 mathlib-bors[bot]

@grunweg Future idea for this linter: Catch #7678 as well.

collares avatar May 27 '24 14:05 collares