-
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.
Mark deep indexed access comparisons as expanding (#33144)
* mark deep indexed accesses as deeply nested in comparisons * Add test derived from lodash example
- Loading branch information
Showing
5 changed files
with
118 additions
and
0 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
17 changes: 17 additions & 0 deletions
17
tests/baselines/reference/comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.js
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,17 @@ | ||
//// [comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts] | ||
type PartialDeep<T> = {[K in keyof T]?: PartialDeep<T[K]>}; | ||
type Many<T> = T | readonly T[]; | ||
|
||
interface Collection<T> { | ||
sortBy(...iteratees: Many<PartialDeep<T>>[]): Collection<T>; | ||
} | ||
|
||
const x: Collection<{x: number}> = (null as any as Collection<{x: number, y: number}>); | ||
|
||
export {}; | ||
|
||
|
||
//// [comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
var x = null; |
40 changes: 40 additions & 0 deletions
40
...baselines/reference/comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.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,40 @@ | ||
=== tests/cases/compiler/comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts === | ||
type PartialDeep<T> = {[K in keyof T]?: PartialDeep<T[K]>}; | ||
>PartialDeep : Symbol(PartialDeep, Decl(comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts, 0, 0)) | ||
>T : Symbol(T, Decl(comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts, 0, 17)) | ||
>K : Symbol(K, Decl(comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts, 0, 24)) | ||
>T : Symbol(T, Decl(comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts, 0, 17)) | ||
>PartialDeep : Symbol(PartialDeep, Decl(comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts, 0, 0)) | ||
>T : Symbol(T, Decl(comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts, 0, 17)) | ||
>K : Symbol(K, Decl(comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts, 0, 24)) | ||
|
||
type Many<T> = T | readonly T[]; | ||
>Many : Symbol(Many, Decl(comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts, 0, 59)) | ||
>T : Symbol(T, Decl(comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts, 1, 10)) | ||
>T : Symbol(T, Decl(comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts, 1, 10)) | ||
>T : Symbol(T, Decl(comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts, 1, 10)) | ||
|
||
interface Collection<T> { | ||
>Collection : Symbol(Collection, Decl(comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts, 1, 32)) | ||
>T : Symbol(T, Decl(comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts, 3, 21)) | ||
|
||
sortBy(...iteratees: Many<PartialDeep<T>>[]): Collection<T>; | ||
>sortBy : Symbol(Collection.sortBy, Decl(comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts, 3, 25)) | ||
>iteratees : Symbol(iteratees, Decl(comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts, 4, 11)) | ||
>Many : Symbol(Many, Decl(comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts, 0, 59)) | ||
>PartialDeep : Symbol(PartialDeep, Decl(comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts, 0, 0)) | ||
>T : Symbol(T, Decl(comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts, 3, 21)) | ||
>Collection : Symbol(Collection, Decl(comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts, 1, 32)) | ||
>T : Symbol(T, Decl(comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts, 3, 21)) | ||
} | ||
|
||
const x: Collection<{x: number}> = (null as any as Collection<{x: number, y: number}>); | ||
>x : Symbol(x, Decl(comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts, 7, 5)) | ||
>Collection : Symbol(Collection, Decl(comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts, 1, 32)) | ||
>x : Symbol(x, Decl(comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts, 7, 21)) | ||
>Collection : Symbol(Collection, Decl(comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts, 1, 32)) | ||
>x : Symbol(x, Decl(comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts, 7, 63)) | ||
>y : Symbol(y, Decl(comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts, 7, 73)) | ||
|
||
export {}; | ||
|
25 changes: 25 additions & 0 deletions
25
...s/baselines/reference/comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.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,25 @@ | ||
=== tests/cases/compiler/comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.ts === | ||
type PartialDeep<T> = {[K in keyof T]?: PartialDeep<T[K]>}; | ||
>PartialDeep : PartialDeep<T> | ||
|
||
type Many<T> = T | readonly T[]; | ||
>Many : Many<T> | ||
|
||
interface Collection<T> { | ||
sortBy(...iteratees: Many<PartialDeep<T>>[]): Collection<T>; | ||
>sortBy : (...iteratees: Many<PartialDeep<T>>[]) => Collection<T> | ||
>iteratees : Many<PartialDeep<T>>[] | ||
} | ||
|
||
const x: Collection<{x: number}> = (null as any as Collection<{x: number, y: number}>); | ||
>x : Collection<{ x: number; }> | ||
>x : number | ||
>(null as any as Collection<{x: number, y: number}>) : Collection<{ x: number; y: number; }> | ||
>null as any as Collection<{x: number, y: number}> : Collection<{ x: number; y: number; }> | ||
>null as any : any | ||
>null : null | ||
>x : number | ||
>y : number | ||
|
||
export {}; | ||
|
11 changes: 11 additions & 0 deletions
11
tests/cases/compiler/comparisonOfPartialDeepAndIndexedAccessTerminatesWithoutError.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,11 @@ | ||
// @strict: true | ||
type PartialDeep<T> = {[K in keyof T]?: PartialDeep<T[K]>}; | ||
type Many<T> = T | readonly T[]; | ||
|
||
interface Collection<T> { | ||
sortBy(...iteratees: Many<PartialDeep<T>>[]): Collection<T>; | ||
} | ||
|
||
const x: Collection<{x: number}> = (null as any as Collection<{x: number, y: number}>); | ||
|
||
export {}; |