Accepted baselines.

This commit is contained in:
Daniel Rosenwasser
2016-02-23 20:07:50 -08:00
parent eb1a70cd16
commit db678493c1
4 changed files with 173 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
tests/cases/compiler/errorMessagesIntersectionTypes03.ts(17,5): error TS2322: Type 'A & B' is not assignable to type 'T'.
Type 'B' is not assignable to type 'T'.
tests/cases/compiler/errorMessagesIntersectionTypes03.ts(18,5): error TS2322: Type 'A & B' is not assignable to type 'U'.
Type 'B' is not assignable to type 'U'.
tests/cases/compiler/errorMessagesIntersectionTypes03.ts(19,5): error TS2322: Type 'A & B' is not assignable to type 'V'.
Type 'B' is not assignable to type 'V'.
tests/cases/compiler/errorMessagesIntersectionTypes03.ts(22,5): error TS2322: Type 'T & B' is not assignable to type 'U'.
Type 'B' is not assignable to type 'U'.
tests/cases/compiler/errorMessagesIntersectionTypes03.ts(23,5): error TS2322: Type 'T & B' is not assignable to type 'V'.
Type 'B' is not assignable to type 'V'.
==== tests/cases/compiler/errorMessagesIntersectionTypes03.ts (5 errors) ====
interface A {
a;
}
interface B {
b;
}
function f<T, U extends A, V extends U>(): void {
let t: T;
let u: U;
let v: V;
let a_and_b: A & B;
let t_and_b: T & B;
t = a_and_b;
~
!!! error TS2322: Type 'A & B' is not assignable to type 'T'.
!!! error TS2322: Type 'B' is not assignable to type 'T'.
u = a_and_b;
~
!!! error TS2322: Type 'A & B' is not assignable to type 'U'.
!!! error TS2322: Type 'B' is not assignable to type 'U'.
v = a_and_b;
~
!!! error TS2322: Type 'A & B' is not assignable to type 'V'.
!!! error TS2322: Type 'B' is not assignable to type 'V'.
t = t_and_b;
u = t_and_b;
~
!!! error TS2322: Type 'T & B' is not assignable to type 'U'.
!!! error TS2322: Type 'B' is not assignable to type 'U'.
v = t_and_b;
~
!!! error TS2322: Type 'T & B' is not assignable to type 'V'.
!!! error TS2322: Type 'B' is not assignable to type 'V'.
}

View File

@@ -0,0 +1,40 @@
//// [errorMessagesIntersectionTypes03.ts]
interface A {
a;
}
interface B {
b;
}
function f<T, U extends A, V extends U>(): void {
let t: T;
let u: U;
let v: V;
let a_and_b: A & B;
let t_and_b: T & B;
t = a_and_b;
u = a_and_b;
v = a_and_b;
t = t_and_b;
u = t_and_b;
v = t_and_b;
}
//// [errorMessagesIntersectionTypes03.js]
function f() {
var t;
var u;
var v;
var a_and_b;
var t_and_b;
t = a_and_b;
u = a_and_b;
v = a_and_b;
t = t_and_b;
u = t_and_b;
v = t_and_b;
}

View File

@@ -0,0 +1,45 @@
tests/cases/compiler/errorMessagesIntersectionTypes04.ts(17,5): error TS2322: Type 'A & B' is not assignable to type 'number'.
Type 'B' is not assignable to type 'number'.
tests/cases/compiler/errorMessagesIntersectionTypes04.ts(18,5): error TS2322: Type 'A & B' is not assignable to type 'boolean'.
Type 'B' is not assignable to type 'boolean'.
tests/cases/compiler/errorMessagesIntersectionTypes04.ts(19,5): error TS2322: Type 'A & B' is not assignable to type 'string'.
Type 'B' is not assignable to type 'string'.
tests/cases/compiler/errorMessagesIntersectionTypes04.ts(21,5): error TS2322: Type 'number & boolean' is not assignable to type 'string'.
Type 'boolean' is not assignable to type 'string'.
==== tests/cases/compiler/errorMessagesIntersectionTypes04.ts (4 errors) ====
interface A {
a;
}
interface B {
b;
}
function f<T, U extends A, V extends U>(): void {
let num: number;
let bool: boolean;
let str: string;
let a_and_b: A & B;
let num_and_bool: number & boolean;
num = a_and_b;
~~~
!!! error TS2322: Type 'A & B' is not assignable to type 'number'.
!!! error TS2322: Type 'B' is not assignable to type 'number'.
bool = a_and_b;
~~~~
!!! error TS2322: Type 'A & B' is not assignable to type 'boolean'.
!!! error TS2322: Type 'B' is not assignable to type 'boolean'.
str = a_and_b;
~~~
!!! error TS2322: Type 'A & B' is not assignable to type 'string'.
!!! error TS2322: Type 'B' is not assignable to type 'string'.
str = num_and_bool;
~~~
!!! error TS2322: Type 'number & boolean' is not assignable to type 'string'.
!!! error TS2322: Type 'boolean' is not assignable to type 'string'.
}

View File

@@ -0,0 +1,36 @@
//// [errorMessagesIntersectionTypes04.ts]
interface A {
a;
}
interface B {
b;
}
function f<T, U extends A, V extends U>(): void {
let num: number;
let bool: boolean;
let str: string;
let a_and_b: A & B;
let num_and_bool: number & boolean;
num = a_and_b;
bool = a_and_b;
str = a_and_b;
str = num_and_bool;
}
//// [errorMessagesIntersectionTypes04.js]
function f() {
var num;
var bool;
var str;
var a_and_b;
var num_and_bool;
num = a_and_b;
bool = a_and_b;
str = a_and_b;
str = num_and_bool;
}