-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Cache propagating variance flags in the relationship cache #32225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
weswigham
merged 3 commits into
microsoft:master
from
weswigham:cache-propegating-variance-flags
Sep 23, 2019
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
25 changes: 25 additions & 0 deletions
25
tests/baselines/reference/varianceRepeatedlyPropegatesWithUnreliableFlag.js
This file contains hidden or 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 @@ | ||
//// [varianceRepeatedlyPropegatesWithUnreliableFlag.ts] | ||
type A = { a: number }; | ||
type B = { b: number }; | ||
type X<T> = ({ [K in keyof T]: T[K] } & Record<string, void>)[keyof T]; | ||
type P1<T> = { data: X<T> }; | ||
type P2<T> = { data: X<T> }; | ||
|
||
interface I<T> { | ||
fn<K extends keyof T>(p1: P1<Pick<T, K>>, p2: P2<Pick<T, K>>): void; | ||
} | ||
|
||
const i: I<A & B> = null as any; | ||
const p2: P2<A> = null as any; | ||
|
||
// Commenting out the below line will remove the error on the `const _i: I<A> = i;` | ||
i.fn(null as any, p2); | ||
|
||
const _i: I<A> = i; | ||
|
||
//// [varianceRepeatedlyPropegatesWithUnreliableFlag.js] | ||
var i = null; | ||
var p2 = null; | ||
// Commenting out the below line will remove the error on the `const _i: I<A> = i;` | ||
i.fn(null, p2); | ||
var _i = i; |
77 changes: 77 additions & 0 deletions
77
tests/baselines/reference/varianceRepeatedlyPropegatesWithUnreliableFlag.symbols
This file contains hidden or 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,77 @@ | ||
=== tests/cases/compiler/varianceRepeatedlyPropegatesWithUnreliableFlag.ts === | ||
type A = { a: number }; | ||
>A : Symbol(A, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 0, 0)) | ||
>a : Symbol(a, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 0, 10)) | ||
|
||
type B = { b: number }; | ||
>B : Symbol(B, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 0, 23)) | ||
>b : Symbol(b, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 1, 10)) | ||
|
||
type X<T> = ({ [K in keyof T]: T[K] } & Record<string, void>)[keyof T]; | ||
>X : Symbol(X, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 1, 23)) | ||
>T : Symbol(T, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 2, 7)) | ||
>K : Symbol(K, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 2, 16)) | ||
>T : Symbol(T, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 2, 7)) | ||
>T : Symbol(T, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 2, 7)) | ||
>K : Symbol(K, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 2, 16)) | ||
>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) | ||
>T : Symbol(T, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 2, 7)) | ||
|
||
type P1<T> = { data: X<T> }; | ||
>P1 : Symbol(P1, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 2, 71)) | ||
>T : Symbol(T, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 3, 8)) | ||
>data : Symbol(data, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 3, 14)) | ||
>X : Symbol(X, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 1, 23)) | ||
>T : Symbol(T, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 3, 8)) | ||
|
||
type P2<T> = { data: X<T> }; | ||
>P2 : Symbol(P2, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 3, 28)) | ||
>T : Symbol(T, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 4, 8)) | ||
>data : Symbol(data, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 4, 14)) | ||
>X : Symbol(X, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 1, 23)) | ||
>T : Symbol(T, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 4, 8)) | ||
|
||
interface I<T> { | ||
>I : Symbol(I, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 4, 28)) | ||
>T : Symbol(T, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 6, 12)) | ||
|
||
fn<K extends keyof T>(p1: P1<Pick<T, K>>, p2: P2<Pick<T, K>>): void; | ||
>fn : Symbol(I.fn, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 6, 16)) | ||
>K : Symbol(K, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 7, 7)) | ||
>T : Symbol(T, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 6, 12)) | ||
>p1 : Symbol(p1, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 7, 26)) | ||
>P1 : Symbol(P1, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 2, 71)) | ||
>Pick : Symbol(Pick, Decl(lib.es5.d.ts, --, --)) | ||
>T : Symbol(T, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 6, 12)) | ||
>K : Symbol(K, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 7, 7)) | ||
>p2 : Symbol(p2, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 7, 45)) | ||
>P2 : Symbol(P2, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 3, 28)) | ||
>Pick : Symbol(Pick, Decl(lib.es5.d.ts, --, --)) | ||
>T : Symbol(T, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 6, 12)) | ||
>K : Symbol(K, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 7, 7)) | ||
} | ||
|
||
const i: I<A & B> = null as any; | ||
>i : Symbol(i, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 10, 5)) | ||
>I : Symbol(I, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 4, 28)) | ||
>A : Symbol(A, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 0, 0)) | ||
>B : Symbol(B, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 0, 23)) | ||
|
||
const p2: P2<A> = null as any; | ||
>p2 : Symbol(p2, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 11, 5)) | ||
>P2 : Symbol(P2, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 3, 28)) | ||
>A : Symbol(A, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 0, 0)) | ||
|
||
// Commenting out the below line will remove the error on the `const _i: I<A> = i;` | ||
i.fn(null as any, p2); | ||
>i.fn : Symbol(I.fn, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 6, 16)) | ||
>i : Symbol(i, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 10, 5)) | ||
>fn : Symbol(I.fn, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 6, 16)) | ||
>p2 : Symbol(p2, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 11, 5)) | ||
|
||
const _i: I<A> = i; | ||
>_i : Symbol(_i, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 16, 5)) | ||
>I : Symbol(I, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 4, 28)) | ||
>A : Symbol(A, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 0, 0)) | ||
>i : Symbol(i, Decl(varianceRepeatedlyPropegatesWithUnreliableFlag.ts, 10, 5)) | ||
|
51 changes: 51 additions & 0 deletions
51
tests/baselines/reference/varianceRepeatedlyPropegatesWithUnreliableFlag.types
This file contains hidden or 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 @@ | ||
=== tests/cases/compiler/varianceRepeatedlyPropegatesWithUnreliableFlag.ts === | ||
type A = { a: number }; | ||
>A : A | ||
>a : number | ||
|
||
type B = { b: number }; | ||
>B : B | ||
>b : number | ||
|
||
type X<T> = ({ [K in keyof T]: T[K] } & Record<string, void>)[keyof T]; | ||
>X : ({ [K in keyof T]: T[K]; } & Record<string, void>)[keyof T] | ||
|
||
type P1<T> = { data: X<T> }; | ||
>P1 : P1<T> | ||
>data : ({ [K in keyof T]: T[K]; } & Record<string, void>)[keyof T] | ||
|
||
type P2<T> = { data: X<T> }; | ||
>P2 : P2<T> | ||
>data : ({ [K in keyof T]: T[K]; } & Record<string, void>)[keyof T] | ||
|
||
interface I<T> { | ||
fn<K extends keyof T>(p1: P1<Pick<T, K>>, p2: P2<Pick<T, K>>): void; | ||
>fn : <K extends keyof T>(p1: P1<Pick<T, K>>, p2: P2<Pick<T, K>>) => void | ||
>p1 : P1<Pick<T, K>> | ||
>p2 : P2<Pick<T, K>> | ||
} | ||
|
||
const i: I<A & B> = null as any; | ||
>i : I<A & B> | ||
>null as any : any | ||
>null : null | ||
|
||
const p2: P2<A> = null as any; | ||
>p2 : P2<A> | ||
>null as any : any | ||
>null : null | ||
|
||
// Commenting out the below line will remove the error on the `const _i: I<A> = i;` | ||
i.fn(null as any, p2); | ||
>i.fn(null as any, p2) : void | ||
>i.fn : <K extends "a" | "b">(p1: P1<Pick<A & B, K>>, p2: P2<Pick<A & B, K>>) => void | ||
>i : I<A & B> | ||
>fn : <K extends "a" | "b">(p1: P1<Pick<A & B, K>>, p2: P2<Pick<A & B, K>>) => void | ||
>null as any : any | ||
>null : null | ||
>p2 : P2<A> | ||
|
||
const _i: I<A> = i; | ||
>_i : I<A> | ||
>i : I<A & B> | ||
|
17 changes: 17 additions & 0 deletions
17
tests/cases/compiler/varianceRepeatedlyPropegatesWithUnreliableFlag.ts
This file contains hidden or 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 @@ | ||
type A = { a: number }; | ||
type B = { b: number }; | ||
type X<T> = ({ [K in keyof T]: T[K] } & Record<string, void>)[keyof T]; | ||
type P1<T> = { data: X<T> }; | ||
type P2<T> = { data: X<T> }; | ||
|
||
interface I<T> { | ||
fn<K extends keyof T>(p1: P1<Pick<T, K>>, p2: P2<Pick<T, K>>): void; | ||
} | ||
|
||
const i: I<A & B> = null as any; | ||
const p2: P2<A> = null as any; | ||
|
||
// Commenting out the below line will remove the error on the `const _i: I<A> = i;` | ||
i.fn(null as any, p2); | ||
|
||
const _i: I<A> = i; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.