Skip to content

Commit

Permalink
fix: #check_failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Kha committed Feb 11, 2021
1 parent a74960a commit 10bcd0b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Lean/Elab/Command.lean
Original file line number Diff line number Diff line change
Expand Up @@ -597,14 +597,16 @@ def failIfSucceeds (x : CommandElabM Unit) : CommandElabM Unit := do
hasNoErrorMessages
catch
| ex@(Exception.error _ _) => do logException ex; pure false
| Exception.internal id _ => do logError "internal"; pure false -- TODO: improve `logError "internal"`
| Exception.internal id _ => do logError (← id.getName); pure false
finally
restoreMessages prevMessages
if succeeded then
throwError "unexpected success"

@[builtinCommandElab «check_failure»] def elabCheckFailure : CommandElab := fun stx =>
failIfSucceeds <| elabCheck stx
@[builtinCommandElab «check_failure»] def elabCheckFailure : CommandElab
| `(#check_failure $term) => do
failIfSucceeds <| elabCheck (← `(#check $term))
| _ => throwUnsupportedSyntax

unsafe def elabEvalUnsafe : CommandElab
| `(#eval%$tk $term) => do
Expand Down

0 comments on commit 10bcd0b

Please sign in to comment.