Constraint-Based refactoring with foresight
Refactoring for generalization using type constraints