diff --git a/helper.ts b/helper.ts index ce4ced3..ab8b191 100644 --- a/helper.ts +++ b/helper.ts @@ -40,7 +40,8 @@ function apply(s: Substitution, value: MonoType | PolyType | Context): MonoType } if (value.type === "ty-quantifier") { - return { ...value, sigma: apply(s, value.sigma) }; + const substitutionWithoutQuantifier = makeSubstitution(Object.fromEntries(Object.entries(s.raw).filter(([k, v]) => k !== value.a))); + return { ...value, sigma: apply(substitutionWithoutQuantifier, value.sigma) }; } throw new Error('Unknown argument passed to substitution')