fix: synthPending bug

This commit is contained in:
Leonardo de Moura 2021-08-04 19:34:46 -07:00
parent aff28f51cd
commit 72e7bf4999
2 changed files with 16 additions and 1 deletions

View file

@ -644,7 +644,7 @@ def synthInstance (type : Expr) (maxResultSize? : Option Nat := none) : MetaM Ex
(fun _ => throwError "failed to synthesize{indentExpr type}")
@[export lean_synth_pending]
private def synthPendingImp (mvarId : MVarId) : MetaM Bool := withIncRecDepth do
private def synthPendingImp (mvarId : MVarId) : MetaM Bool := withIncRecDepth <| withMVarContext mvarId do
let mvarDecl ← getMVarDecl mvarId
match mvarDecl.kind with
| MetavarKind.synthetic =>

View file

@ -0,0 +1,15 @@
inductive Nested
| nest (a : Array Nested) : Nested
class OfUnit (α : Type) where
ofUnit : Unit → Except String α
instance myArrayInst [OfUnit α] : OfUnit (Array α) where
ofUnit _ := Except.error ""
open OfUnit
partial def ofUnitNested (_ : Unit) : Except String Nested := do
let localinst : OfUnit Nested := ⟨ofUnitNested⟩
let units : Array Unit ← Except.ok #[]
let a ← ofUnit ()
return Nested.nest a