- -- TODO: Use free variables instead of is_wild. is_wild is a hack.
- if is_wild b || Type.isFunTy (Id.idType b)
- -- Don't create extra bindings for binders that are already wild, or
- -- for binders that bind function types (to prevent loops with
+ if not (VarSet.elemVarSet b free_vars) || Type.isFunTy (Id.idType b)
+ -- Don't create extra bindings for binders that are already wild
+ -- (e.g. not in the free variables of expr, so unused), or for
+ -- binders that bind function types (to prevent loops with