Skip to content

Commit

Permalink
helper: Fix applying substitution with shadowed type variable names i…
Browse files Browse the repository at this point in the history
…n type quantifiers
  • Loading branch information
domdomegg committed Aug 20, 2024
1 parent 53fc543 commit 26af0e9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 26af0e9

Please sign in to comment.