Skip to content

Commit

Permalink
Add baselines for test from microsoft#43485
Browse files Browse the repository at this point in the history
  • Loading branch information
weswigham committed Apr 1, 2021
1 parent 950d0ce commit 363e392
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
tests/cases/compiler/conditionalTypeVarianceBigArrayConstraintsPerformance.ts(9,5): error TS2322: Type 'Stuff<U>' is not assignable to type 'Stuff<T>'.
Type 'U' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'U'.


==== tests/cases/compiler/conditionalTypeVarianceBigArrayConstraintsPerformance.ts (1 errors) ====
/// <reference path="/.lib/react16.d.ts" />

type Stuff<T> =
T extends keyof JSX.IntrinsicElements
? JSX.IntrinsicElements[T]
: any;

function F<T, U>(p1: Stuff<T>, p2: Stuff<U>) {
p1 = p2; // Error
~~
!!! error TS2322: Type 'Stuff<U>' is not assignable to type 'Stuff<T>'.
!!! error TS2322: Type 'U' is not assignable to type 'T'.
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'U'.
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//// [conditionalTypeVarianceBigArrayConstraintsPerformance.ts]
/// <reference path="/.lib/react16.d.ts" />

type Stuff<T> =
T extends keyof JSX.IntrinsicElements
? JSX.IntrinsicElements[T]
: any;

function F<T, U>(p1: Stuff<T>, p2: Stuff<U>) {
p1 = p2; // Error
}

//// [conditionalTypeVarianceBigArrayConstraintsPerformance.js]
/// <reference path="react16.d.ts" />
function F(p1, p2) {
p1 = p2; // Error
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
=== tests/cases/compiler/conditionalTypeVarianceBigArrayConstraintsPerformance.ts ===
/// <reference path="react16.d.ts" />

type Stuff<T> =
>Stuff : Symbol(Stuff, Decl(conditionalTypeVarianceBigArrayConstraintsPerformance.ts, 0, 0))
>T : Symbol(T, Decl(conditionalTypeVarianceBigArrayConstraintsPerformance.ts, 2, 11))

T extends keyof JSX.IntrinsicElements
>T : Symbol(T, Decl(conditionalTypeVarianceBigArrayConstraintsPerformance.ts, 2, 11))
>JSX : Symbol(JSX, Decl(react16.d.ts, 2493, 12))
>IntrinsicElements : Symbol(JSX.IntrinsicElements, Decl(react16.d.ts, 2514, 86))

? JSX.IntrinsicElements[T]
>JSX : Symbol(JSX, Decl(react16.d.ts, 2493, 12))
>IntrinsicElements : Symbol(JSX.IntrinsicElements, Decl(react16.d.ts, 2514, 86))
>T : Symbol(T, Decl(conditionalTypeVarianceBigArrayConstraintsPerformance.ts, 2, 11))

: any;

function F<T, U>(p1: Stuff<T>, p2: Stuff<U>) {
>F : Symbol(F, Decl(conditionalTypeVarianceBigArrayConstraintsPerformance.ts, 5, 14))
>T : Symbol(T, Decl(conditionalTypeVarianceBigArrayConstraintsPerformance.ts, 7, 11))
>U : Symbol(U, Decl(conditionalTypeVarianceBigArrayConstraintsPerformance.ts, 7, 13))
>p1 : Symbol(p1, Decl(conditionalTypeVarianceBigArrayConstraintsPerformance.ts, 7, 17))
>Stuff : Symbol(Stuff, Decl(conditionalTypeVarianceBigArrayConstraintsPerformance.ts, 0, 0))
>T : Symbol(T, Decl(conditionalTypeVarianceBigArrayConstraintsPerformance.ts, 7, 11))
>p2 : Symbol(p2, Decl(conditionalTypeVarianceBigArrayConstraintsPerformance.ts, 7, 30))
>Stuff : Symbol(Stuff, Decl(conditionalTypeVarianceBigArrayConstraintsPerformance.ts, 0, 0))
>U : Symbol(U, Decl(conditionalTypeVarianceBigArrayConstraintsPerformance.ts, 7, 13))

p1 = p2; // Error
>p1 : Symbol(p1, Decl(conditionalTypeVarianceBigArrayConstraintsPerformance.ts, 7, 17))
>p2 : Symbol(p2, Decl(conditionalTypeVarianceBigArrayConstraintsPerformance.ts, 7, 30))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
=== tests/cases/compiler/conditionalTypeVarianceBigArrayConstraintsPerformance.ts ===
/// <reference path="react16.d.ts" />

type Stuff<T> =
>Stuff : Stuff<T>

T extends keyof JSX.IntrinsicElements
>JSX : any

? JSX.IntrinsicElements[T]
>JSX : any

: any;

function F<T, U>(p1: Stuff<T>, p2: Stuff<U>) {
>F : <T, U>(p1: Stuff<T>, p2: Stuff<U>) => void
>p1 : Stuff<T>
>p2 : Stuff<U>

p1 = p2; // Error
>p1 = p2 : Stuff<U>
>p1 : Stuff<T>
>p2 : Stuff<U>
}

0 comments on commit 363e392

Please sign in to comment.