-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: display deprecation warning for simp lemmas on the lemma name #4448
Conversation
Mathlib CI status (docs):
|
src/Lean/Elab/Tactic/Simp.lean
Outdated
@@ -204,7 +204,7 @@ def elabSimpArgs (stx : Syntax) (ctx : Simp.Context) (simprocs : Simp.SimprocsAr | |||
arg[0][0].getKind == ``Parser.Tactic.simpPost | |||
let inv := !arg[1].isNone | |||
let term := arg[2] | |||
match (← resolveSimpIdTheorem? term) with | |||
match (← withRef arg do resolveSimpIdTheorem? term) with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
match (← withRef arg do resolveSimpIdTheorem? term) with | |
match (← withRef term do resolveSimpIdTheorem? term) with |
It seems more reasonable to use the term
itself rather than the whole arg
(which potentially includes the inversion arrow). Alternatively, the withRef
could be integrated into resolveSimpIdTheorem?
itself, which might be even better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overlooked the second suggestion, but just addressed that now, see below.
In the Zulip chat it was suggested to add a test. Would this (updated to the correct message) work? import Lean.Elab.Command
@[deprecated]
theorem hi : True := .intro
open Lean Elab.Command
elab "msgs_lines " cmd:command : command => do
elabCommand cmd
let msgs := (← get).messages.unreported.toList
if let [m] := msgs then logInfo m!"{(m.pos, m.endPos)}"
/--
warning: `hi` has been deprecated
---
info: (⟨20, 2⟩, some (⟨22, 3⟩))
-/
#guard_msgs in
msgs_lines
example : True := by
simp [
hi
] |
Haha, I like it. The traditional way is to do it like the tests in |
Co-authored-by: Mac Malone <tydeu@hatpress.net>
@semorrison I did add a test to the best of my knowledge (as EDIT: I guess the failing CI in af33b4a suggests it does indeed work :D |
@semorrison I managed to get the tests correctly :) I don't think I can remove the |
This reverts commit b5f9cb3.
It seems that this was now fixed by #4484, please re-open if I am confused. Thanks for helping, though! |
Absolutely, thanks for the fix! |
I also tried the web-server and I can still see the old |
Did you try the "Nightly" version of the webeditor? (go to settings and change the project) It seems to be as intended: |
Ah, no, I did not know that this was possible! I can confirm that on the "nightly", the issue that I had raised is resolved, both for I am not really able to comment whether this is the "right" solution, but I would be very happy if this behaviour became standard! Thanks! |
Oh, I realize now that you are saying that this already is the behaviour, it just has not trickled down to Mathlib! Anyway, this is great, thanks! |
exactly, I assume that means it'll be in |
Closes #4452