fix: must collect occurrences in the types

This commit is contained in:
Leonardo de Moura 2020-07-21 16:53:47 -07:00
parent c17a87bdda
commit be4d65e936

View file

@ -262,7 +262,11 @@ match type with
private def removeUnused (ref : Syntax) (scopeVars : Array Expr) (params : Array Expr) (fieldInfos : Array StructFieldInfo)
: TermElabM (LocalContext × LocalInstances × Array Expr) := do
used ← params.foldlM (Term.collectUsedFVars ref) {};
used ← params.foldlM
(fun (used : CollectFVars.State) p => do
type ← Term.inferType ref p;
Term.collectUsedFVars ref used type)
{};
used ← fieldInfos.foldlM
(fun (used : CollectFVars.State) info => do
fvarType ← Term.inferType ref info.fvar;