Fix PR2977: LegalizeTypes support for expanding