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, public type: Type,
) { ) {
super(); super();
if (typeVars instanceof TVSet) { this.typeVars = new TVSet();
this.typeVars = typeVars; const allowed = new TVSet(type.getTypeVars());
} else { for (const tv of typeVars) {
this.typeVars = new TVSet(typeVars); if (allowed.has(tv)) {
this.typeVars.add(tv);
}
} }
} }