forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request microsoft#20400 from Microsoft/limit-recursive-str…
…uctured-type-resolution Limit recursive structured type resolution
- Loading branch information
Showing
9 changed files
with
254 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
//// [mutuallyRecursiveInference.ts] | ||
class T<A> { | ||
a: A; | ||
b: any | ||
} | ||
class L<RT extends { a: 'a' | 'b', b: any }> extends T<RT[RT['a']]> { | ||
m() { this.a } | ||
} | ||
class X extends L<X> { | ||
a: 'a' | 'b' | ||
b: number | ||
m2() { | ||
this.a | ||
} | ||
} | ||
|
||
|
||
//// [mutuallyRecursiveInference.js] | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var T = /** @class */ (function () { | ||
function T() { | ||
} | ||
return T; | ||
}()); | ||
var L = /** @class */ (function (_super) { | ||
__extends(L, _super); | ||
function L() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
L.prototype.m = function () { this.a; }; | ||
return L; | ||
}(T)); | ||
var X = /** @class */ (function (_super) { | ||
__extends(X, _super); | ||
function X() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
X.prototype.m2 = function () { | ||
this.a; | ||
}; | ||
return X; | ||
}(L)); |
48 changes: 48 additions & 0 deletions
48
tests/baselines/reference/mutuallyRecursiveInference.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
=== tests/cases/compiler/mutuallyRecursiveInference.ts === | ||
class T<A> { | ||
>T : Symbol(T, Decl(mutuallyRecursiveInference.ts, 0, 0)) | ||
>A : Symbol(A, Decl(mutuallyRecursiveInference.ts, 0, 8)) | ||
|
||
a: A; | ||
>a : Symbol(T.a, Decl(mutuallyRecursiveInference.ts, 0, 12)) | ||
>A : Symbol(A, Decl(mutuallyRecursiveInference.ts, 0, 8)) | ||
|
||
b: any | ||
>b : Symbol(T.b, Decl(mutuallyRecursiveInference.ts, 1, 9)) | ||
} | ||
class L<RT extends { a: 'a' | 'b', b: any }> extends T<RT[RT['a']]> { | ||
>L : Symbol(L, Decl(mutuallyRecursiveInference.ts, 3, 1)) | ||
>RT : Symbol(RT, Decl(mutuallyRecursiveInference.ts, 4, 8)) | ||
>a : Symbol(a, Decl(mutuallyRecursiveInference.ts, 4, 20)) | ||
>b : Symbol(b, Decl(mutuallyRecursiveInference.ts, 4, 34)) | ||
>T : Symbol(T, Decl(mutuallyRecursiveInference.ts, 0, 0)) | ||
>RT : Symbol(RT, Decl(mutuallyRecursiveInference.ts, 4, 8)) | ||
>RT : Symbol(RT, Decl(mutuallyRecursiveInference.ts, 4, 8)) | ||
|
||
m() { this.a } | ||
>m : Symbol(L.m, Decl(mutuallyRecursiveInference.ts, 4, 69)) | ||
>this.a : Symbol(T.a, Decl(mutuallyRecursiveInference.ts, 0, 12)) | ||
>this : Symbol(L, Decl(mutuallyRecursiveInference.ts, 3, 1)) | ||
>a : Symbol(T.a, Decl(mutuallyRecursiveInference.ts, 0, 12)) | ||
} | ||
class X extends L<X> { | ||
>X : Symbol(X, Decl(mutuallyRecursiveInference.ts, 6, 1)) | ||
>L : Symbol(L, Decl(mutuallyRecursiveInference.ts, 3, 1)) | ||
>X : Symbol(X, Decl(mutuallyRecursiveInference.ts, 6, 1)) | ||
|
||
a: 'a' | 'b' | ||
>a : Symbol(X.a, Decl(mutuallyRecursiveInference.ts, 7, 22)) | ||
|
||
b: number | ||
>b : Symbol(X.b, Decl(mutuallyRecursiveInference.ts, 8, 16)) | ||
|
||
m2() { | ||
>m2 : Symbol(X.m2, Decl(mutuallyRecursiveInference.ts, 9, 13)) | ||
|
||
this.a | ||
>this.a : Symbol(X.a, Decl(mutuallyRecursiveInference.ts, 7, 22)) | ||
>this : Symbol(X, Decl(mutuallyRecursiveInference.ts, 6, 1)) | ||
>a : Symbol(X.a, Decl(mutuallyRecursiveInference.ts, 7, 22)) | ||
} | ||
} | ||
|
48 changes: 48 additions & 0 deletions
48
tests/baselines/reference/mutuallyRecursiveInference.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
=== tests/cases/compiler/mutuallyRecursiveInference.ts === | ||
class T<A> { | ||
>T : T<A> | ||
>A : A | ||
|
||
a: A; | ||
>a : A | ||
>A : A | ||
|
||
b: any | ||
>b : any | ||
} | ||
class L<RT extends { a: 'a' | 'b', b: any }> extends T<RT[RT['a']]> { | ||
>L : L<RT> | ||
>RT : RT | ||
>a : "a" | "b" | ||
>b : any | ||
>T : T<RT[RT["a"]]> | ||
>RT : RT | ||
>RT : RT | ||
|
||
m() { this.a } | ||
>m : () => void | ||
>this.a : RT[RT["a"]] | ||
>this : this | ||
>a : RT[RT["a"]] | ||
} | ||
class X extends L<X> { | ||
>X : X | ||
>L : L<X> | ||
>X : X | ||
|
||
a: 'a' | 'b' | ||
>a : "a" | "b" | ||
|
||
b: number | ||
>b : number | ||
|
||
m2() { | ||
>m2 : () => void | ||
|
||
this.a | ||
>this.a : "a" | "b" | ||
>this : this | ||
>a : "a" | "b" | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class T<A> { | ||
a: A; | ||
b: any | ||
} | ||
class L<RT extends { a: 'a' | 'b', b: any }> extends T<RT[RT['a']]> { | ||
m() { this.a } | ||
} | ||
class X extends L<X> { | ||
a: 'a' | 'b' | ||
b: number | ||
m2() { | ||
this.a | ||
} | ||
} |