Skip to content

Commit 36fc918

Browse files
committed
Fix: also elaborate config correctly in presence of ! in convert_to
1 parent 66ddb61 commit 36fc918

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

Mathlib/Tactic/Convert.lean

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,11 @@ def elabTermForConvert (term : Syntax) (expectedType? : Option Expr) :
208208
return t
209209

210210
elab_rules : tactic
211-
| `(tactic| convert%$tk $[!%$semired]? $cfg $[←%$sym]? $term $[using $n]? $[with $ps?*]?) =>
211+
| `(tactic| convert%$tk $[!%$semireducible]? $cfg $[←%$sym]? $term $[using $n]? $[with $ps?*]?) =>
212212
withMainContext do
213213
let baseConfig := { ← Convert.elabConfig cfg with }
214214
let mut config := baseConfig
215-
if semired.isSome then
215+
if semireducible.isSome then
216216
config := { config with
217217
-- TODO: also enable this in the future? (Not right now, for backwards compatibility).
218218
-- transparency := default,
@@ -221,7 +221,7 @@ elab_rules : tactic
221221
let patterns := (ps?.getD #[]).toList
222222
let expectedType ← mkFreshExprMVar (mkSort (← getLevel (← getMainTarget)))
223223
let (e, gs) ← elabTermForConvert term expectedType
224-
if semired.isSome then
224+
if semireducible.isSome then
225225
liftMetaTactic fun g ↦ do
226226
-- Suggest `convert` instead of `convert!` if that gives us the same goals.
227227
let redGoals ← g.convert e sym.isSome (n.map (·.getNat)) baseConfig patterns
@@ -285,9 +285,13 @@ elab_rules : tactic
285285
| `(tactic| convert_to $[!%$semireducible]? $cfg $[←%$sym]? $newType $[using $n]?
286286
$[with $ps?*]? $[$loc?:location]?) => do
287287
let n : ℕ := n |>.map (·.getNat) |>.getD 1
288-
let mut config := { ← Convert.elabConfig cfg with }
289-
if semireducible.isSome then
290-
config := { config with postTransparency := .default }
288+
let mut config := { ← Convert.elabConfig cfg with }
289+
if semireducible.isSome then
290+
config := { config with
291+
-- TODO: also enable this in the future? (Not right now, for backwards compatibility).
292+
-- transparency := default,
293+
-- preTransparency := default,
294+
postTransparency := default }
291295
let patterns := (ps?.getD #[]).toList
292296
withLocation (expandOptLocation (mkOptionalNode loc?))
293297
(atLocal := fun fvarId ↦ do

0 commit comments

Comments
 (0)