Manually filter out type variables in type scheme that do nothing

This commit is contained in:
Sam Vervaeck 2023-03-19 15:04:47 +01:00
parent d5e85869fb
commit 947b6d8740

View file

@ -838,10 +838,12 @@ class Forall extends SchemeBase {
public type: Type,
) {
super();
if (typeVars instanceof TVSet) {
this.typeVars = typeVars;
} else {
this.typeVars = new TVSet(typeVars);
this.typeVars = new TVSet();
const allowed = new TVSet(type.getTypeVars());
for (const tv of typeVars) {
if (allowed.has(tv)) {
this.typeVars.add(tv);
}
}
}