fix bug in polymorphic types (when creating a tuple of two empty lists, there was only one type variable (the type of the list), whereas each list could have a different type, so there should be two type variables) + make type variables look nicer

This commit is contained in:
Joeri Exelmans 2025-04-04 10:04:40 +02:00
parent 8ac0c6d3dd
commit 342d4b34ef
2 changed files with 32 additions and 7 deletions

View file

@ -62,7 +62,7 @@ export function prettyT(type) {
}
if (type.typeVars) {
if (type.typeVars.size > 0) {
return `(${[...type.typeVars].map(prettyT).join(", ")}): ${prettyT(type.type)}`;
return `${[...type.typeVars].map(prettyT).sort((a,b)=>a.localeCompare(b)).join(",")}: ${prettyT(type.type)}`;
}
else {
return prettyT(type.type);