Skip to content

Commit

Permalink
chore: add indents to guard_target and friends (#426)
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-wieser authored Dec 7, 2023
1 parent c4ece13 commit c3bd1ac
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Std/Tactic/GuardExpr.lean
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ def evalGuardTarget : Tactic :=
let t ← getTgt >>= instantiateMVars
let r ← elabTerm r (← inferType t)
let some mk := equal.toMatchKind eq | throwUnsupportedSyntax
unless ← mk.isEq r t do throwError "target of main goal is {t}, not {r}"
unless ← mk.isEq r t do
throwError "target of main goal is{indentExpr t}\nnot{indentExpr r}"
fun
| `(tactic| guard_target $eq $r) => go eq r getMainTarget
| `(conv| guard_target $eq $r) => go eq r Conv.getLhs
Expand Down Expand Up @@ -181,15 +182,17 @@ def evalGuardHyp : Tactic := fun
let some mk := colon.toMatchKind c | throwUnsupportedSyntax
let e ← elabTerm p none
let hty ← instantiateMVars lDecl.type
unless ← mk.isEq e hty do throwError m!"hypothesis {h} has type {hty}, not {e}"
unless ← mk.isEq e hty do
throwError m!"hypothesis {h} has type{indentExpr hty}\nnot{indentExpr e}"
match lDecl.value?, val with
| none, some _ => throwError m!"{h} is not a let binding"
| some _, none => throwError m!"{h} is a let binding"
| some hval, some val =>
let some mk := eq.bind colonEq.toMatchKind | throwUnsupportedSyntax
let e ← elabTerm val lDecl.type
let hval ← instantiateMVars hval
unless ← mk.isEq e hval do throwError m!"hypothesis {h} has value {hval}, not {e}"
unless ← mk.isEq e hval do
throwError m!"hypothesis {h} has value{indentExpr hval}\nnot{indentExpr e}"
| none, none => pure ()
| _ => throwUnsupportedSyntax

Expand Down

0 comments on commit c3bd1ac

Please sign in to comment.