-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce effective maximum constraint depth for instances of the same c…
…onditional
- Loading branch information
Showing
7 changed files
with
147 additions
and
6 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
18 changes: 18 additions & 0 deletions
18
tests/baselines/reference/conditionalPrependNoHang.errors.txt
Large diffs are not rendered by default.
Oops, something went wrong.
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 @@ | ||
//// [conditionalPrependNoHang.ts] | ||
export type Prepend<Elm, T extends unknown[]> = | ||
T extends unknown ? | ||
((arg: Elm, ...rest: T) => void) extends ((...args: infer T2) => void) ? T2 : | ||
never : | ||
never; | ||
export type ExactExtract<T, U> = T extends U ? U extends T ? T : never : never; | ||
|
||
type Conv<T, U = T> = | ||
{ 0: [T]; 1: Prepend<T, Conv<ExactExtract<U, T>>>;}[U extends T ? 0 : 1]; | ||
|
||
//// [conditionalPrependNoHang.js] | ||
"use strict"; | ||
exports.__esModule = true; |
49 changes: 49 additions & 0 deletions
49
tests/baselines/reference/conditionalPrependNoHang.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,49 @@ | ||
=== tests/cases/compiler/conditionalPrependNoHang.ts === | ||
export type Prepend<Elm, T extends unknown[]> = | ||
>Prepend : Symbol(Prepend, Decl(conditionalPrependNoHang.ts, 0, 0)) | ||
>Elm : Symbol(Elm, Decl(conditionalPrependNoHang.ts, 0, 20)) | ||
>T : Symbol(T, Decl(conditionalPrependNoHang.ts, 0, 24)) | ||
|
||
T extends unknown ? | ||
>T : Symbol(T, Decl(conditionalPrependNoHang.ts, 0, 24)) | ||
|
||
((arg: Elm, ...rest: T) => void) extends ((...args: infer T2) => void) ? T2 : | ||
>arg : Symbol(arg, Decl(conditionalPrependNoHang.ts, 2, 4)) | ||
>Elm : Symbol(Elm, Decl(conditionalPrependNoHang.ts, 0, 20)) | ||
>rest : Symbol(rest, Decl(conditionalPrependNoHang.ts, 2, 13)) | ||
>T : Symbol(T, Decl(conditionalPrependNoHang.ts, 0, 24)) | ||
>args : Symbol(args, Decl(conditionalPrependNoHang.ts, 2, 45)) | ||
>T2 : Symbol(T2, Decl(conditionalPrependNoHang.ts, 2, 59)) | ||
>T2 : Symbol(T2, Decl(conditionalPrependNoHang.ts, 2, 59)) | ||
|
||
never : | ||
never; | ||
export type ExactExtract<T, U> = T extends U ? U extends T ? T : never : never; | ||
>ExactExtract : Symbol(ExactExtract, Decl(conditionalPrependNoHang.ts, 4, 8)) | ||
>T : Symbol(T, Decl(conditionalPrependNoHang.ts, 5, 25)) | ||
>U : Symbol(U, Decl(conditionalPrependNoHang.ts, 5, 27)) | ||
>T : Symbol(T, Decl(conditionalPrependNoHang.ts, 5, 25)) | ||
>U : Symbol(U, Decl(conditionalPrependNoHang.ts, 5, 27)) | ||
>U : Symbol(U, Decl(conditionalPrependNoHang.ts, 5, 27)) | ||
>T : Symbol(T, Decl(conditionalPrependNoHang.ts, 5, 25)) | ||
>T : Symbol(T, Decl(conditionalPrependNoHang.ts, 5, 25)) | ||
|
||
type Conv<T, U = T> = | ||
>Conv : Symbol(Conv, Decl(conditionalPrependNoHang.ts, 5, 79)) | ||
>T : Symbol(T, Decl(conditionalPrependNoHang.ts, 7, 10)) | ||
>U : Symbol(U, Decl(conditionalPrependNoHang.ts, 7, 12)) | ||
>T : Symbol(T, Decl(conditionalPrependNoHang.ts, 7, 10)) | ||
|
||
{ 0: [T]; 1: Prepend<T, Conv<ExactExtract<U, T>>>;}[U extends T ? 0 : 1]; | ||
>0 : Symbol(0, Decl(conditionalPrependNoHang.ts, 8, 3)) | ||
>T : Symbol(T, Decl(conditionalPrependNoHang.ts, 7, 10)) | ||
>1 : Symbol(1, Decl(conditionalPrependNoHang.ts, 8, 11)) | ||
>Prepend : Symbol(Prepend, Decl(conditionalPrependNoHang.ts, 0, 0)) | ||
>T : Symbol(T, Decl(conditionalPrependNoHang.ts, 7, 10)) | ||
>Conv : Symbol(Conv, Decl(conditionalPrependNoHang.ts, 5, 79)) | ||
>ExactExtract : Symbol(ExactExtract, Decl(conditionalPrependNoHang.ts, 4, 8)) | ||
>U : Symbol(U, Decl(conditionalPrependNoHang.ts, 7, 12)) | ||
>T : Symbol(T, Decl(conditionalPrependNoHang.ts, 7, 10)) | ||
>U : Symbol(U, Decl(conditionalPrependNoHang.ts, 7, 12)) | ||
>T : Symbol(T, Decl(conditionalPrependNoHang.ts, 7, 10)) | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
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,9 @@ | ||
export type Prepend<Elm, T extends unknown[]> = | ||
T extends unknown ? | ||
((arg: Elm, ...rest: T) => void) extends ((...args: infer T2) => void) ? T2 : | ||
never : | ||
never; | ||
export type ExactExtract<T, U> = T extends U ? U extends T ? T : never : never; | ||
|
||
type Conv<T, U = T> = | ||
{ 0: [T]; 1: Prepend<T, Conv<ExactExtract<U, T>>>;}[U extends T ? 0 : 1]; |