One performance-oriented fix is to weaken intersection types that are subtypes of INTEGER to the tightest INTEGER type possible.
A slightly simpler fix is to defer to the BACKEND-TYPE-PREDICATE logic as soon as a hairy type is involved; this ends being, at best, as weak as the first option.
A more safety-oriented fix punts on weakening types that include any undefined type. We would get the style warning, but it doesn't seem to follow the spirit of WEAKEN-TYPE.
I'm very much inclined to go with the first fix. This is WEAKEN-TYPE, after all. Discuss, but I'll try to commit a fix before release.
This deserves more thought.
One performance- oriented fix is to weaken intersection types that are subtypes of INTEGER to the tightest INTEGER type possible.
A slightly simpler fix is to defer to the BACKEND- TYPE-PREDICATE logic as soon as a hairy type is involved; this ends being, at best, as weak as the first option.
A more safety-oriented fix punts on weakening types that include any undefined type. We would get the style warning, but it doesn't seem to follow the spirit of WEAKEN-TYPE.
I'm very much inclined to go with the first fix. This is WEAKEN-TYPE, after all. Discuss, but I'll try to commit a fix before release.