feat: add a syntax linter version of the impossibleInstance and nonClassInstance linters #1717
feat: add a syntax linter version of the impossibleInstance and nonClassInstance linters #1717MoritzBeroRoos wants to merge 78 commits intoleanprover-community:mainfrom
Conversation
|
One question i have is: |
Co-authored-by: François G. Dorais <fgdorais@gmail.com>
Co-authored-by: François G. Dorais <fgdorais@gmail.com>
Co-authored-by: François G. Dorais <fgdorais@gmail.com>
review: batteries#1717 (impossibleInstance and nonClassInstance syntax linters)
|
There is no mechanism for delegation in batteries, but I informally delegate this PR to @thorimur and @Vierkantor. Once you both approve this PR, notify me and I will do a final check (just to be sure, I trust you!) before merging. Thanks for your generous help! (I could use more of that help from time to time 😃 ) |
| protected def Lean.LocalDecl.ppAsBinder : LocalDecl → Option MessageData | ||
| | .ldecl .. => none | ||
| | .cdecl _ fvarId _ type binderInfo _ => | ||
| let (lBracket, rBracket) : String × String := match binderInfo with |
There was a problem hiding this comment.
Note that docs#Lean.BinderInfo.brackets seems to do something very similar.
There was a problem hiding this comment.
But it strangely does {{...}} instead of ⦃...⦄. (FWIW, I personally prefer the former but the latter is more prevalent.)
There was a problem hiding this comment.
Since Lean will show ⦃...⦄ even if the user inputted {{...}}, i think we should also go with ⦃...⦄ here
|
Please merge main now that #1754 has landed. |
Currently we have the
impossibleInstanceandnonClassInstancelinters which are environment linters in batteries.impossibleInstancewarns when it detects an instance with arguments that are not inferable for typeclass synthesis.nonClassInstancewarns when a non-class-valued function is declared asinstance.These linters are especially useful for beginners who don't yet understand how typeclass synthesis works.
But since these linters currently are environment linters they only fire in CI or when manually using
#lint.However beginners don't typically have CI set up for their pet projects and mostly don't know about
#lint.This PR adresses this issue by adding syntax linter versions of these two linters.
These will automatically check every declaration and thus be of much more use to beginners.