Add test
This commit is contained in:
parent
dc28aaa132
commit
4e9e62d861
15
tests/baselines/reference/noStrictGenericChecks.js
Normal file
15
tests/baselines/reference/noStrictGenericChecks.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
//// [noStrictGenericChecks.ts]
|
||||
type A = <T, U>(x: T, y: U) => [T, U];
|
||||
type B = <S>(x: S, y: S) => [S, S];
|
||||
|
||||
function f(a: A, b: B) {
|
||||
a = b; // Error disabled here
|
||||
b = a; // Ok
|
||||
}
|
||||
|
||||
|
||||
//// [noStrictGenericChecks.js]
|
||||
function f(a, b) {
|
||||
a = b; // Error disabled here
|
||||
b = a; // Ok
|
||||
}
|
38
tests/baselines/reference/noStrictGenericChecks.symbols
Normal file
38
tests/baselines/reference/noStrictGenericChecks.symbols
Normal file
|
@ -0,0 +1,38 @@
|
|||
=== tests/cases/compiler/noStrictGenericChecks.ts ===
|
||||
type A = <T, U>(x: T, y: U) => [T, U];
|
||||
>A : Symbol(A, Decl(noStrictGenericChecks.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(noStrictGenericChecks.ts, 0, 10))
|
||||
>U : Symbol(U, Decl(noStrictGenericChecks.ts, 0, 12))
|
||||
>x : Symbol(x, Decl(noStrictGenericChecks.ts, 0, 16))
|
||||
>T : Symbol(T, Decl(noStrictGenericChecks.ts, 0, 10))
|
||||
>y : Symbol(y, Decl(noStrictGenericChecks.ts, 0, 21))
|
||||
>U : Symbol(U, Decl(noStrictGenericChecks.ts, 0, 12))
|
||||
>T : Symbol(T, Decl(noStrictGenericChecks.ts, 0, 10))
|
||||
>U : Symbol(U, Decl(noStrictGenericChecks.ts, 0, 12))
|
||||
|
||||
type B = <S>(x: S, y: S) => [S, S];
|
||||
>B : Symbol(B, Decl(noStrictGenericChecks.ts, 0, 38))
|
||||
>S : Symbol(S, Decl(noStrictGenericChecks.ts, 1, 10))
|
||||
>x : Symbol(x, Decl(noStrictGenericChecks.ts, 1, 13))
|
||||
>S : Symbol(S, Decl(noStrictGenericChecks.ts, 1, 10))
|
||||
>y : Symbol(y, Decl(noStrictGenericChecks.ts, 1, 18))
|
||||
>S : Symbol(S, Decl(noStrictGenericChecks.ts, 1, 10))
|
||||
>S : Symbol(S, Decl(noStrictGenericChecks.ts, 1, 10))
|
||||
>S : Symbol(S, Decl(noStrictGenericChecks.ts, 1, 10))
|
||||
|
||||
function f(a: A, b: B) {
|
||||
>f : Symbol(f, Decl(noStrictGenericChecks.ts, 1, 35))
|
||||
>a : Symbol(a, Decl(noStrictGenericChecks.ts, 3, 11))
|
||||
>A : Symbol(A, Decl(noStrictGenericChecks.ts, 0, 0))
|
||||
>b : Symbol(b, Decl(noStrictGenericChecks.ts, 3, 16))
|
||||
>B : Symbol(B, Decl(noStrictGenericChecks.ts, 0, 38))
|
||||
|
||||
a = b; // Error disabled here
|
||||
>a : Symbol(a, Decl(noStrictGenericChecks.ts, 3, 11))
|
||||
>b : Symbol(b, Decl(noStrictGenericChecks.ts, 3, 16))
|
||||
|
||||
b = a; // Ok
|
||||
>b : Symbol(b, Decl(noStrictGenericChecks.ts, 3, 16))
|
||||
>a : Symbol(a, Decl(noStrictGenericChecks.ts, 3, 11))
|
||||
}
|
||||
|
40
tests/baselines/reference/noStrictGenericChecks.types
Normal file
40
tests/baselines/reference/noStrictGenericChecks.types
Normal file
|
@ -0,0 +1,40 @@
|
|||
=== tests/cases/compiler/noStrictGenericChecks.ts ===
|
||||
type A = <T, U>(x: T, y: U) => [T, U];
|
||||
>A : A
|
||||
>T : T
|
||||
>U : U
|
||||
>x : T
|
||||
>T : T
|
||||
>y : U
|
||||
>U : U
|
||||
>T : T
|
||||
>U : U
|
||||
|
||||
type B = <S>(x: S, y: S) => [S, S];
|
||||
>B : B
|
||||
>S : S
|
||||
>x : S
|
||||
>S : S
|
||||
>y : S
|
||||
>S : S
|
||||
>S : S
|
||||
>S : S
|
||||
|
||||
function f(a: A, b: B) {
|
||||
>f : (a: A, b: B) => void
|
||||
>a : A
|
||||
>A : A
|
||||
>b : B
|
||||
>B : B
|
||||
|
||||
a = b; // Error disabled here
|
||||
>a = b : B
|
||||
>a : A
|
||||
>b : B
|
||||
|
||||
b = a; // Ok
|
||||
>b = a : A
|
||||
>b : B
|
||||
>a : A
|
||||
}
|
||||
|
9
tests/cases/compiler/noStrictGenericChecks.ts
Normal file
9
tests/cases/compiler/noStrictGenericChecks.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
// @noStrictGenericChecks: true
|
||||
|
||||
type A = <T, U>(x: T, y: U) => [T, U];
|
||||
type B = <S>(x: S, y: S) => [S, S];
|
||||
|
||||
function f(a: A, b: B) {
|
||||
a = b; // Error disabled here
|
||||
b = a; // Ok
|
||||
}
|
Loading…
Reference in a new issue