Skip to content

Commit

Permalink
fix: make #check_failure's output be info (leanprover#6685)
Browse files Browse the repository at this point in the history
This PR fixes the issue that `#check_failure`'s output is warning

Closes leanprover#6684
  • Loading branch information
Seasawher authored and luisacicolini committed Jan 21, 2025
1 parent 1311246 commit e57245c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Lean/Elab/BuiltinCommand.lean
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def failIfSucceeds (x : CommandElabM Unit) : CommandElabM Unit := do
modify fun s => { s with messages := {} };
pure messages
let restoreMessages (prevMessages : MessageLog) : CommandElabM Unit := do
modify fun s => { s with messages := prevMessages ++ s.messages.errorsToWarnings }
modify fun s => { s with messages := prevMessages ++ s.messages.errorsToInfos }
let prevMessages ← resetMessages
let succeeded ← try
x
Expand Down
3 changes: 3 additions & 0 deletions src/Lean/Message.lean
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,9 @@ def markAllReported (log : MessageLog) : MessageLog :=
def errorsToWarnings (log : MessageLog) : MessageLog :=
{ unreported := log.unreported.map (fun m => match m.severity with | MessageSeverity.error => { m with severity := MessageSeverity.warning } | _ => m) }

def errorsToInfos (log : MessageLog) : MessageLog :=
{ unreported := log.unreported.map (fun m => match m.severity with | MessageSeverity.error => { m with severity := MessageSeverity.information } | _ => m) }

def getInfoMessages (log : MessageLog) : MessageLog :=
{ unreported := log.unreported.filter fun m => match m.severity with | MessageSeverity.information => true | _ => false }

Expand Down
2 changes: 1 addition & 1 deletion tests/lean/run/autoLift.lean
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ set_option autoLift false

set_option pp.mvars false in
/--
warning: type mismatch
info: type mismatch
f
has type
IO Nat : Type
Expand Down

0 comments on commit e57245c

Please sign in to comment.