Fix generalisation during type inference (again); fixes Trac #1564