Skip to content

Commit

Permalink
Skip caching for tail recursive temporary conditional types
Browse files Browse the repository at this point in the history
  • Loading branch information
ahejlsberg committed Sep 4, 2021
1 parent 093f76a commit a4224d6
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15322,19 +15322,17 @@ namespace ts {
if (newRoot.outerTypeParameters) {
const typeParamMapper = combineTypeMappers((newType as ConditionalType).mapper, newMapper);
const typeArguments = map(newRoot.outerTypeParameters, t => getMappedType(t, typeParamMapper));
if (!newRoot.instantiations!.get(getTypeListId(typeArguments))) {
const newRootMapper = createTypeMapper(newRoot.outerTypeParameters, typeArguments);
const newCheckType = newRoot.isDistributive ? getMappedType(newRoot.checkType, newRootMapper) : undefined;
if (!newCheckType || newCheckType === newRoot.checkType || !(newCheckType.flags & (TypeFlags.Union | TypeFlags.Never))) {
root = newRoot;
mapper = newRootMapper;
aliasSymbol = undefined;
aliasTypeArguments = undefined;
if (newRoot.aliasSymbol) {
tailCount++;
}
return true;
const newRootMapper = createTypeMapper(newRoot.outerTypeParameters, typeArguments);
const newCheckType = newRoot.isDistributive ? getMappedType(newRoot.checkType, newRootMapper) : undefined;
if (!newCheckType || newCheckType === newRoot.checkType || !(newCheckType.flags & (TypeFlags.Union | TypeFlags.Never))) {
root = newRoot;
mapper = newRootMapper;
aliasSymbol = undefined;
aliasTypeArguments = undefined;
if (newRoot.aliasSymbol) {
tailCount++;
}
return true;
}
}
}
Expand Down

0 comments on commit a4224d6

Please sign in to comment.