@@ -5195,23 +5195,27 @@ module ts {
5195
5195
else if (source.flags & TypeFlags.ObjectType && (target.flags & (TypeFlags.Reference | TypeFlags.Tuple) ||
5196
5196
(target.flags & TypeFlags.Anonymous) && target.symbol && target.symbol.flags & (SymbolFlags.Method | SymbolFlags.TypeLiteral))) {
5197
5197
// If source is an object type, and target is a type reference, a tuple type, the type of a method, or a type literal, infer from members
5198
- if (!isInProcess(source, target) && !(isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth))) {
5199
- if (depth === 0) {
5200
- sourceStack = [];
5201
- targetStack = [];
5202
- }
5203
- sourceStack[depth] = source;
5204
- targetStack[depth] = target;
5205
- depth++;
5206
- inferFromProperties(source, target);
5207
- inferFromSignatures(source, target, SignatureKind.Call);
5208
- inferFromSignatures(source, target, SignatureKind.Construct);
5209
- inferFromIndexTypes(source, target, IndexKind.String, IndexKind.String);
5210
- inferFromIndexTypes(source, target, IndexKind.Number, IndexKind.Number);
5211
- inferFromIndexTypes(source, target, IndexKind.String, IndexKind.Number);
5212
- depth--;
5198
+ if (isInProcess(source, target)) {
5199
+ return;
5213
5200
}
5214
- }
5201
+ if (isDeeplyNestedGeneric(source, sourceStack, depth) && isDeeplyNestedGeneric(target, targetStack, depth)) {
5202
+ return;
5203
+ }
5204
+
5205
+ if (depth === 0) {
5206
+ sourceStack = [];
5207
+ targetStack = [];
5208
+ }
5209
+ sourceStack[depth] = source;
5210
+ targetStack[depth] = target;
5211
+ depth++;
5212
+ inferFromProperties(source, target);
5213
+ inferFromSignatures(source, target, SignatureKind.Call);
5214
+ inferFromSignatures(source, target, SignatureKind.Construct);
5215
+ inferFromIndexTypes(source, target, IndexKind.String, IndexKind.String);
5216
+ inferFromIndexTypes(source, target, IndexKind.Number, IndexKind.Number);
5217
+ inferFromIndexTypes(source, target, IndexKind.String, IndexKind.Number);
5218
+ depth--; }
5215
5219
}
5216
5220
5217
5221
function inferFromProperties(source: Type, target: Type) {
0 commit comments