Skip to content

Commit 9eb4dbe

Browse files
committed
also reset dsimpCache
1 parent e0b35ff commit 9eb4dbe

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/Lean/Meta/Tactic/Simp/Main.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ partial def simpNonDepLetFun (e : Expr) : SimpM Result := do
721721
def simpApp (e : Expr) : SimpM Result := do
722722
if isOfNatNatLit e || isOfScientificLit e then
723723
-- Recall that we fold "orphan" kernel Nat literals `n` into `OfNat.ofNat n`
724-
withFreshCache <| withInNumLit <| congr e
724+
withFreshCache <| withFreshDSimpCache <| withInNumLit <| congr e
725725
else if isCharLit e then
726726
return { expr := e }
727727
else if isNonDepLetFun e then

src/Lean/Meta/Tactic/Simp/Types.lean

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,14 @@ Save current cache, reset it, execute `x`, and then restore original cache.
483483
modify fun s => { s with cache := {} }
484484
try x finally modify fun s => { s with cache := cacheSaved }
485485

486+
/--
487+
Save current `dsimpCache`, reset it, execute `x`, and then resotre original cache.
488+
-/
489+
@[inline] def withFreshDSimpCache (x : SimpM α) : SimpM α := do
490+
let cacheSaved := (← get).dsimpCache
491+
modify fun s => { s with dsimpCache := {} }
492+
try x finally modify fun s => { s with dsimpCache := cacheSaved }
493+
486494
@[inline] def withDischarger (discharge? : Expr → SimpM (Option Expr)) (wellBehavedDischarge : Bool) (x : SimpM α) : SimpM α :=
487495
withFreshCache <|
488496
withReader (fun r => { MethodsRef.toMethods r with discharge?, wellBehavedDischarge }.toMethodsRef) x

0 commit comments

Comments
 (0)