Update tests

This commit is contained in:
Anders Hejlsberg 2017-09-25 16:59:39 -07:00
parent 91691f6079
commit 6a481e8ddc
3 changed files with 65 additions and 29 deletions

View File

@ -17,15 +17,19 @@ tests/cases/compiler/strictFunctionTypesErrors.ts(21,1): error TS2322: Type '(x:
tests/cases/compiler/strictFunctionTypesErrors.ts(23,1): error TS2322: Type '(x: string) => Object' is not assignable to type '(x: string) => string'.
Type 'Object' is not assignable to type 'string'.
tests/cases/compiler/strictFunctionTypesErrors.ts(33,1): error TS2322: Type 'Func<string, Object>' is not assignable to type 'Func<Object, Object>'.
Type 'Object' is not assignable to type 'string'.
Types of parameters 'x' and 'x' are incompatible.
Type 'Object' is not assignable to type 'string'.
tests/cases/compiler/strictFunctionTypesErrors.ts(34,1): error TS2322: Type 'Func<string, string>' is not assignable to type 'Func<Object, Object>'.
Type 'Object' is not assignable to type 'string'.
Types of parameters 'x' and 'x' are incompatible.
Type 'Object' is not assignable to type 'string'.
tests/cases/compiler/strictFunctionTypesErrors.ts(36,1): error TS2322: Type 'Func<Object, Object>' is not assignable to type 'Func<Object, string>'.
Type 'Object' is not assignable to type 'string'.
tests/cases/compiler/strictFunctionTypesErrors.ts(37,1): error TS2322: Type 'Func<string, Object>' is not assignable to type 'Func<Object, string>'.
Type 'Object' is not assignable to type 'string'.
Types of parameters 'x' and 'x' are incompatible.
Type 'Object' is not assignable to type 'string'.
tests/cases/compiler/strictFunctionTypesErrors.ts(38,1): error TS2322: Type 'Func<string, string>' is not assignable to type 'Func<Object, string>'.
Type 'Object' is not assignable to type 'string'.
Types of parameters 'x' and 'x' are incompatible.
Type 'Object' is not assignable to type 'string'.
tests/cases/compiler/strictFunctionTypesErrors.ts(44,1): error TS2322: Type 'Func<Object, Object>' is not assignable to type 'Func<string, string>'.
Type 'Object' is not assignable to type 'string'.
tests/cases/compiler/strictFunctionTypesErrors.ts(46,1): error TS2322: Type 'Func<string, Object>' is not assignable to type 'Func<string, string>'.
@ -35,32 +39,46 @@ tests/cases/compiler/strictFunctionTypesErrors.ts(57,1): error TS2322: Type 'Fun
tests/cases/compiler/strictFunctionTypesErrors.ts(58,1): error TS2322: Type 'Func<Func<string, void>, Object>' is not assignable to type 'Func<Func<Object, void>, string>'.
Type 'Object' is not assignable to type 'string'.
tests/cases/compiler/strictFunctionTypesErrors.ts(61,1): error TS2322: Type 'Func<Func<Object, void>, Object>' is not assignable to type 'Func<Func<string, void>, Object>'.
Type 'Func<string, void>' is not assignable to type 'Func<Object, void>'.
Type 'Object' is not assignable to type 'string'.
Types of parameters 'x' and 'x' are incompatible.
Types of parameters 'x' and 'x' are incompatible.
Type 'Object' is not assignable to type 'string'.
tests/cases/compiler/strictFunctionTypesErrors.ts(62,1): error TS2322: Type 'Func<Func<Object, void>, string>' is not assignable to type 'Func<Func<string, void>, Object>'.
Type 'Func<string, void>' is not assignable to type 'Func<Object, void>'.
Types of parameters 'x' and 'x' are incompatible.
Types of parameters 'x' and 'x' are incompatible.
Type 'Object' is not assignable to type 'string'.
tests/cases/compiler/strictFunctionTypesErrors.ts(65,1): error TS2322: Type 'Func<Func<Object, void>, Object>' is not assignable to type 'Func<Func<string, void>, string>'.
Type 'Func<string, void>' is not assignable to type 'Func<Object, void>'.
Types of parameters 'x' and 'x' are incompatible.
Types of parameters 'x' and 'x' are incompatible.
Type 'Object' is not assignable to type 'string'.
tests/cases/compiler/strictFunctionTypesErrors.ts(66,1): error TS2322: Type 'Func<Func<Object, void>, string>' is not assignable to type 'Func<Func<string, void>, string>'.
Type 'Func<string, void>' is not assignable to type 'Func<Object, void>'.
Types of parameters 'x' and 'x' are incompatible.
Types of parameters 'x' and 'x' are incompatible.
Type 'Object' is not assignable to type 'string'.
tests/cases/compiler/strictFunctionTypesErrors.ts(67,1): error TS2322: Type 'Func<Func<string, void>, Object>' is not assignable to type 'Func<Func<string, void>, string>'.
Type 'Object' is not assignable to type 'string'.
tests/cases/compiler/strictFunctionTypesErrors.ts(74,1): error TS2322: Type 'Func<Object, Func<string, void>>' is not assignable to type 'Func<Object, Func<Object, void>>'.
Type 'Func<string, void>' is not assignable to type 'Func<Object, void>'.
Types of parameters 'x' and 'x' are incompatible.
Type 'Object' is not assignable to type 'string'.
tests/cases/compiler/strictFunctionTypesErrors.ts(75,1): error TS2322: Type 'Func<string, Func<Object, void>>' is not assignable to type 'Func<Object, Func<Object, void>>'.
Type 'Object' is not assignable to type 'string'.
Types of parameters 'x' and 'x' are incompatible.
Type 'Object' is not assignable to type 'string'.
tests/cases/compiler/strictFunctionTypesErrors.ts(76,1): error TS2322: Type 'Func<string, Func<string, void>>' is not assignable to type 'Func<Object, Func<Object, void>>'.
Type 'Object' is not assignable to type 'string'.
Types of parameters 'x' and 'x' are incompatible.
Type 'Object' is not assignable to type 'string'.
tests/cases/compiler/strictFunctionTypesErrors.ts(79,1): error TS2322: Type 'Func<string, Func<Object, void>>' is not assignable to type 'Func<Object, Func<string, void>>'.
Type 'Object' is not assignable to type 'string'.
Types of parameters 'x' and 'x' are incompatible.
Type 'Object' is not assignable to type 'string'.
tests/cases/compiler/strictFunctionTypesErrors.ts(80,1): error TS2322: Type 'Func<string, Func<string, void>>' is not assignable to type 'Func<Object, Func<string, void>>'.
Type 'Object' is not assignable to type 'string'.
Types of parameters 'x' and 'x' are incompatible.
Type 'Object' is not assignable to type 'string'.
tests/cases/compiler/strictFunctionTypesErrors.ts(83,1): error TS2322: Type 'Func<Object, Func<string, void>>' is not assignable to type 'Func<string, Func<Object, void>>'.
Type 'Func<string, void>' is not assignable to type 'Func<Object, void>'.
tests/cases/compiler/strictFunctionTypesErrors.ts(84,1): error TS2322: Type 'Func<string, Func<string, void>>' is not assignable to type 'Func<string, Func<Object, void>>'.
Type 'Func<string, void>' is not assignable to type 'Func<Object, void>'.
tests/cases/compiler/strictFunctionTypesErrors.ts(111,1): error TS2322: Type 'Comparer2<Dog>' is not assignable to type 'Comparer2<Animal>'.
Type 'Animal' is not assignable to type 'Dog'.
Property 'dog' is missing in type 'Animal'.
==== tests/cases/compiler/strictFunctionTypesErrors.ts (29 errors) ====
@ -113,7 +131,7 @@ tests/cases/compiler/strictFunctionTypesErrors.ts(111,1): error TS2322: Type 'Co
!!! error TS2322: Type '(x: string) => Object' is not assignable to type '(x: string) => string'.
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
interface Func<T, U> { (x: T): U }
type Func<T, U> = (x: T) => U;
declare let g1: Func<Object, Object>;
declare let g2: Func<Object, string>;
@ -124,11 +142,13 @@ tests/cases/compiler/strictFunctionTypesErrors.ts(111,1): error TS2322: Type 'Co
g1 = g3; // Error
~~
!!! error TS2322: Type 'Func<string, Object>' is not assignable to type 'Func<Object, Object>'.
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
g1 = g4; // Error
~~
!!! error TS2322: Type 'Func<string, string>' is not assignable to type 'Func<Object, Object>'.
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
g2 = g1; // Error
~~
@ -137,11 +157,13 @@ tests/cases/compiler/strictFunctionTypesErrors.ts(111,1): error TS2322: Type 'Co
g2 = g3; // Error
~~
!!! error TS2322: Type 'Func<string, Object>' is not assignable to type 'Func<Object, string>'.
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
g2 = g4; // Error
~~
!!! error TS2322: Type 'Func<string, string>' is not assignable to type 'Func<Object, string>'.
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
g3 = g1; // Ok
g3 = g2; // Ok
@ -179,22 +201,29 @@ tests/cases/compiler/strictFunctionTypesErrors.ts(111,1): error TS2322: Type 'Co
h3 = h1; // Error
~~
!!! error TS2322: Type 'Func<Func<Object, void>, Object>' is not assignable to type 'Func<Func<string, void>, Object>'.
!!! error TS2322: Type 'Func<string, void>' is not assignable to type 'Func<Object, void>'.
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
h3 = h2; // Error
~~
!!! error TS2322: Type 'Func<Func<Object, void>, string>' is not assignable to type 'Func<Func<string, void>, Object>'.
!!! error TS2322: Type 'Func<string, void>' is not assignable to type 'Func<Object, void>'.
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
h3 = h4; // Ok
h4 = h1; // Error
~~
!!! error TS2322: Type 'Func<Func<Object, void>, Object>' is not assignable to type 'Func<Func<string, void>, string>'.
!!! error TS2322: Type 'Func<string, void>' is not assignable to type 'Func<Object, void>'.
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
h4 = h2; // Error
~~
!!! error TS2322: Type 'Func<Func<Object, void>, string>' is not assignable to type 'Func<Func<string, void>, string>'.
!!! error TS2322: Type 'Func<string, void>' is not assignable to type 'Func<Object, void>'.
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
h4 = h3; // Error
~~
!!! error TS2322: Type 'Func<Func<string, void>, Object>' is not assignable to type 'Func<Func<string, void>, string>'.
@ -209,24 +238,30 @@ tests/cases/compiler/strictFunctionTypesErrors.ts(111,1): error TS2322: Type 'Co
~~
!!! error TS2322: Type 'Func<Object, Func<string, void>>' is not assignable to type 'Func<Object, Func<Object, void>>'.
!!! error TS2322: Type 'Func<string, void>' is not assignable to type 'Func<Object, void>'.
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
i1 = i3; // Error
~~
!!! error TS2322: Type 'Func<string, Func<Object, void>>' is not assignable to type 'Func<Object, Func<Object, void>>'.
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
i1 = i4; // Error
~~
!!! error TS2322: Type 'Func<string, Func<string, void>>' is not assignable to type 'Func<Object, Func<Object, void>>'.
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
i2 = i1; // Ok
i2 = i3; // Error
~~
!!! error TS2322: Type 'Func<string, Func<Object, void>>' is not assignable to type 'Func<Object, Func<string, void>>'.
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
i2 = i4; // Error
~~
!!! error TS2322: Type 'Func<string, Func<string, void>>' is not assignable to type 'Func<Object, Func<string, void>>'.
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
!!! error TS2322: Type 'Object' is not assignable to type 'string'.
i3 = i1; // Ok
i3 = i2; // Error
@ -267,5 +302,6 @@ tests/cases/compiler/strictFunctionTypesErrors.ts(111,1): error TS2322: Type 'Co
~~~~~~~~~~~~~~~
!!! error TS2322: Type 'Comparer2<Dog>' is not assignable to type 'Comparer2<Animal>'.
!!! error TS2322: Type 'Animal' is not assignable to type 'Dog'.
!!! error TS2322: Property 'dog' is missing in type 'Animal'.
dogComparer2 = animalComparer2; // Ok

View File

@ -23,7 +23,7 @@ f4 = f1; // Error
f4 = f2; // Ok
f4 = f3; // Error
interface Func<T, U> { (x: T): U }
type Func<T, U> = (x: T) => U;
declare let g1: Func<Object, Object>;
declare let g2: Func<Object, string>;

View File

@ -23,7 +23,7 @@ f4 = f1; // Error
f4 = f2; // Ok
f4 = f3; // Error
interface Func<T, U> { (x: T): U }
type Func<T, U> = (x: T) => U;
declare let g1: Func<Object, Object>;
declare let g2: Func<Object, string>;