fix: reset set of stuck mvars after reporting they are stuck

This bug produced the doubled error message at issue #337
This commit is contained in:
Leonardo de Moura 2021-03-08 12:40:05 -08:00
parent 5d3f0606d2
commit f321ad213f
2 changed files with 2 additions and 4 deletions

View file

@ -163,8 +163,8 @@ private def synthesizeUsingDefault : TermElabM Bool := do
/-- Report an error for each synthetic metavariable that could not be resolved. -/
private def reportStuckSyntheticMVars : TermElabM Unit := do
let s ← get
for mvarSyntheticDecl in s.syntheticMVars do
let syntheticMVars ← modifyGet fun s => (s.syntheticMVars, { s with syntheticMVars := [] })
for mvarSyntheticDecl in syntheticMVars do
withRef mvarSyntheticDecl.stx do
match mvarSyntheticDecl.kind with
| SyntheticMVarKind.typeClass =>

View file

@ -1,6 +1,4 @@
297.lean:1:10-1:11: error: typeclass instance problem is stuck, it is often due to metavariables
OfNat (Sort ?u) 0
297.lean:1:13-3:1: error: invalid universe level, u_1 is not greater than 0
297.lean:1:10-1:11: error: failed to synthesize instance
OfNat (Sort u_1) 0
297.lean:1:8-1:9: error: (kernel) declaration has metavariables 'r'