-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed crash on circular local type arguments when outer ones are pres…
…ent too (#59089) Co-authored-by: Gabriela Araujo Britto <gabrielaa@microsoft.com>
- Loading branch information
Showing
5 changed files
with
61 additions
and
2 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
13 changes: 13 additions & 0 deletions
13
tests/baselines/reference/circularTypeArgumentsLocalAndOuterNoCrash1.errors.txt
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,13 @@ | ||
circularTypeArgumentsLocalAndOuterNoCrash1.ts(5,12): error TS4109: Type arguments for 'NumArray' circularly reference themselves. | ||
|
||
|
||
==== circularTypeArgumentsLocalAndOuterNoCrash1.ts (1 errors) ==== | ||
// https://github.com/microsoft/TypeScript/issues/59062 | ||
|
||
function f<_T, _S>() { | ||
interface NumArray<T extends number> extends Array<T> {} | ||
type X = NumArray<X extends {} ? number : number>; | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS4109: Type arguments for 'NumArray' circularly reference themselves. | ||
} | ||
|
22 changes: 22 additions & 0 deletions
22
tests/baselines/reference/circularTypeArgumentsLocalAndOuterNoCrash1.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,22 @@ | ||
//// [tests/cases/compiler/circularTypeArgumentsLocalAndOuterNoCrash1.ts] //// | ||
|
||
=== circularTypeArgumentsLocalAndOuterNoCrash1.ts === | ||
// https://github.com/microsoft/TypeScript/issues/59062 | ||
|
||
function f<_T, _S>() { | ||
>f : Symbol(f, Decl(circularTypeArgumentsLocalAndOuterNoCrash1.ts, 0, 0)) | ||
>_T : Symbol(_T, Decl(circularTypeArgumentsLocalAndOuterNoCrash1.ts, 2, 11)) | ||
>_S : Symbol(_S, Decl(circularTypeArgumentsLocalAndOuterNoCrash1.ts, 2, 14)) | ||
|
||
interface NumArray<T extends number> extends Array<T> {} | ||
>NumArray : Symbol(NumArray, Decl(circularTypeArgumentsLocalAndOuterNoCrash1.ts, 2, 22)) | ||
>T : Symbol(T, Decl(circularTypeArgumentsLocalAndOuterNoCrash1.ts, 3, 21)) | ||
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) | ||
>T : Symbol(T, Decl(circularTypeArgumentsLocalAndOuterNoCrash1.ts, 3, 21)) | ||
|
||
type X = NumArray<X extends {} ? number : number>; | ||
>X : Symbol(X, Decl(circularTypeArgumentsLocalAndOuterNoCrash1.ts, 3, 58)) | ||
>NumArray : Symbol(NumArray, Decl(circularTypeArgumentsLocalAndOuterNoCrash1.ts, 2, 22)) | ||
>X : Symbol(X, Decl(circularTypeArgumentsLocalAndOuterNoCrash1.ts, 3, 58)) | ||
} | ||
|
15 changes: 15 additions & 0 deletions
15
tests/baselines/reference/circularTypeArgumentsLocalAndOuterNoCrash1.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,15 @@ | ||
//// [tests/cases/compiler/circularTypeArgumentsLocalAndOuterNoCrash1.ts] //// | ||
|
||
=== circularTypeArgumentsLocalAndOuterNoCrash1.ts === | ||
// https://github.com/microsoft/TypeScript/issues/59062 | ||
|
||
function f<_T, _S>() { | ||
>f : <_T, _S>() => void | ||
> : ^ ^^ ^^^^^^^^^^^ | ||
|
||
interface NumArray<T extends number> extends Array<T> {} | ||
type X = NumArray<X extends {} ? number : number>; | ||
>X : NumArray<any> | ||
> : ^^^^^^^^^^^^^ | ||
} | ||
|
9 changes: 9 additions & 0 deletions
9
tests/cases/compiler/circularTypeArgumentsLocalAndOuterNoCrash1.ts
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,9 @@ | ||
// @strict: true | ||
// @noEmit: true | ||
|
||
// https://github.com/microsoft/TypeScript/issues/59062 | ||
|
||
function f<_T, _S>() { | ||
interface NumArray<T extends number> extends Array<T> {} | ||
type X = NumArray<X extends {} ? number : number>; | ||
} |