feat: Capture mvar errors
This commit is contained in:
parent
7fc2bd0d0f
commit
47d26badc8
|
@ -208,8 +208,12 @@ protected def GoalState.tryTacticM (state: GoalState) (goal: MVarId) (tacticM: E
|
|||
try
|
||||
let nextState ← state.step goal tacticM
|
||||
|
||||
Elab.Term.synthesizeSyntheticMVarsNoPostponing
|
||||
let descendants ← Meta.getMVars $ ← instantiateMVars (.mvar goal)
|
||||
let _ ← Elab.Term.logUnassignedUsingErrorInfos descendants
|
||||
|
||||
-- Check if error messages have been generated in the core.
|
||||
let newMessages ← (← Core.getMessageLog).toList.drop state.coreState.messages.toList.length
|
||||
let newMessages ← (← Core.getMessageLog).toList --.drop state.coreState.messages.toList.length
|
||||
|>.filterMapM λ m => do
|
||||
if m.severity == .error then
|
||||
return .some $ ← m.toString
|
||||
|
|
|
@ -720,6 +720,7 @@ def test_tactic_failure_unresolved_goals : TestM Unit := do
|
|||
let .failure messages ← state1.tacticOn 0 tactic | addTest $ assertUnreachable s!"{tactic} should fail"
|
||||
checkEq s!"{tactic} fails" messages #[s!"{← getFileName}:0:12: error: unsolved goals\np : Nat → Prop\n⊢ p 0\n"]
|
||||
|
||||
|
||||
def test_tactic_failure_synthesize_placeholder : TestM Unit := do
|
||||
let state? ← startProof (.expr "∀ (p q r : Prop) (h : p → q), q ∧ r")
|
||||
let state0 ← match state? with
|
||||
|
@ -737,7 +738,8 @@ def test_tactic_failure_synthesize_placeholder : TestM Unit := do
|
|||
|
||||
let tactic := "simpa [h] using And.imp_left h _"
|
||||
let .failure messages ← state1.tacticOn 0 tactic | addTest $ assertUnreachable s!"{tactic} should fail"
|
||||
checkEq s!"{tactic} fails" messages #[s!"{← getFileName}:0:12: error: unsolved goals\np : Nat → Prop\n⊢ p 0\n"]
|
||||
let message := s!"<Pantograph>:0:31: error: don't know how to synthesize placeholder\ncontext:\np q r : Prop\nh : p → q\n⊢ p ∧ r\n"
|
||||
checkEq s!"{tactic} fails" messages #[message]
|
||||
|
||||
def suite (env: Environment): List (String × IO LSpec.TestSeq) :=
|
||||
let tests := [
|
||||
|
|
Loading…
Reference in New Issue