Move Infer.ExprRefs.optimizeContext to its own module