feat: instantiate metavariables in LocalDecls
This commit is contained in:
parent
00d46e4a7d
commit
87d506cb90
2 changed files with 11 additions and 0 deletions
|
|
@ -401,6 +401,7 @@ patternVarDecls.foldlM
|
|||
assignExprMVar newMVarId (mkFVar fvarId);
|
||||
trace `Elab.match fun _ => "finalizePatternDecls: " ++ mkMVar newMVarId ++ " := " ++ mkFVar fvarId;
|
||||
decl ← getLocalDecl fvarId;
|
||||
decl ← liftMetaM $ Meta.instantiateLocalDeclMVars decl;
|
||||
pure $ decls.push decl
|
||||
| _ => pure decls)
|
||||
#[]
|
||||
|
|
|
|||
|
|
@ -429,6 +429,16 @@ if e.hasMVar then
|
|||
else
|
||||
pure e
|
||||
|
||||
def instantiateLocalDeclMVars (localDecl : LocalDecl) : MetaM LocalDecl :=
|
||||
match localDecl with
|
||||
| LocalDecl.cdecl idx id n type bi => do
|
||||
type ← instantiateMVars type;
|
||||
pure $ LocalDecl.cdecl idx id n type bi
|
||||
| LocalDecl.ldecl idx id n type val => do
|
||||
type ← instantiateMVars type;
|
||||
val ← instantiateMVars val;
|
||||
pure $ LocalDecl.ldecl idx id n type val
|
||||
|
||||
@[inline] private def liftMkBindingM {α} (x : MetavarContext.MkBindingM α) : MetaM α :=
|
||||
fun ctx s =>
|
||||
match x ctx.lctx { mctx := s.mctx, ngen := s.ngen } with
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue