@@ -17740,18 +17740,18 @@ namespace ts {
1774017740 // results for union and intersection types for performance reasons.
1774117741 function couldContainTypeVariables(type: Type): boolean {
1774217742 const objectFlags = getObjectFlags(type);
17743- return !!(type.flags & TypeFlags.Instantiable ||
17743+ if (objectFlags & ObjectFlags.CouldContainTypeVariablesComputed) {
17744+ return !!(objectFlags & ObjectFlags.CouldContainTypeVariables);
17745+ }
17746+ const result = !!(type.flags & TypeFlags.Instantiable ||
1774417747 objectFlags & ObjectFlags.Reference && ((<TypeReference>type).node || forEach(getTypeArguments(<TypeReference>type), couldContainTypeVariables)) ||
1774517748 objectFlags & ObjectFlags.Anonymous && type.symbol && type.symbol.flags & (SymbolFlags.Function | SymbolFlags.Method | SymbolFlags.Class | SymbolFlags.TypeLiteral | SymbolFlags.ObjectLiteral) && type.symbol.declarations ||
1774617749 objectFlags & (ObjectFlags.Mapped | ObjectFlags.ObjectRestType) ||
17747- type.flags & TypeFlags.UnionOrIntersection && !(type.flags & TypeFlags.EnumLiteral) && couldUnionOrIntersectionContainTypeVariables(<UnionOrIntersectionType>type));
17748- }
17749-
17750- function couldUnionOrIntersectionContainTypeVariables(type: UnionOrIntersectionType): boolean {
17751- if (type.couldContainTypeVariables === undefined) {
17752- type.couldContainTypeVariables = some(type.types, couldContainTypeVariables);
17750+ type.flags & TypeFlags.UnionOrIntersection && !(type.flags & TypeFlags.EnumLiteral) && some((<UnionOrIntersectionType>type).types, couldContainTypeVariables));
17751+ if (type.flags & TypeFlags.ObjectFlagsType) {
17752+ (<ObjectFlagsType>type).objectFlags |= ObjectFlags.CouldContainTypeVariablesComputed | (result ? ObjectFlags.CouldContainTypeVariables : 0);
1775317753 }
17754- return type.couldContainTypeVariables ;
17754+ return result ;
1775517755 }
1775617756
1775717757 function isTypeParameterAtTopLevel(type: Type, typeParameter: TypeParameter): boolean {
0 commit comments