fix: use Term.withSynthesize at rewrite

This commit is contained in:
Leonardo de Moura 2021-02-20 12:59:41 -08:00
parent bcd8f09672
commit 65ea26422a
2 changed files with 3 additions and 3 deletions

View file

@ -16,7 +16,7 @@ open Meta
/- `elabTerm` for Tactics and basic tactics that use it. -/
def elabTerm (stx : Syntax) (expectedType? : Option Expr) (mayPostpone := false) : TacticM Expr :=
withRef stx $ liftTermElabM $ Term.withoutErrToSorry do
withRef stx <| liftTermElabM <| Term.withoutErrToSorry do
let e ← Term.elabTerm stx expectedType?
Term.synthesizeSyntheticMVars mayPostpone
instantiateMVars e

View file

@ -23,7 +23,7 @@ open Meta
def rewriteTarget (stx : Syntax) (symm : Bool) (mode : TransparencyMode) : TacticM Unit := do
let (g, gs) ← getMainGoal
withMVarContext g do
Term.withSynthesize <| withMVarContext g do
let e ← elabTerm stx none true
let target ← instantiateMVars (← getMVarDecl g).type
let r ← rewrite g target e symm (mode := mode)
@ -32,7 +32,7 @@ def rewriteTarget (stx : Syntax) (symm : Bool) (mode : TransparencyMode) : Tacti
def rewriteLocalDeclFVarId (stx : Syntax) (symm : Bool) (fvarId : FVarId) (mode : TransparencyMode) : TacticM Unit := do
let (g, gs) ← getMainGoal
withMVarContext g do
Term.withSynthesize <| withMVarContext g do
let e ← elabTerm stx none true
let localDecl ← getLocalDecl fvarId
let rwResult ← rewrite g localDecl.type e symm (mode := mode)