let free_vars = VarSet.varSetElems $ CoreFVs.exprSomeFreeVars interesting arg
-- Mark the current expression as changed
setChanged
+ -- TODO: Clone the free_vars (and update references in arg), since
+ -- this might cause conflicts if two arguments that are propagated
+ -- share a free variable. Also, we are now introducing new variables
+ -- into a function that are not fresh, which violates the binder
+ -- uniqueness invariant.
return (map Var free_vars, free_vars, arg)
else do
-- Representable types will not be propagated, and arguments with free
-- type variables will be propagated later.
+ -- Note that we implicitly remove any type variables in the type of
+ -- the original argument by using the type of the actual argument
+ -- for the new formal parameter.
-- TODO: preserve original naming?
id <- Trans.lift $ mkBinderFor arg "param"
-- Just pass the original argument to the new function, which binds it