Accepted baselines.

This commit is contained in:
Daniel Rosenwasser 2016-01-04 22:39:47 -05:00
parent 24a108936f
commit 4484ca062e
10 changed files with 135 additions and 0 deletions

View file

@ -0,0 +1,8 @@
//// [contextuallyTypeCommaOperator01.ts]
let x: (a: string) => string;
x = (100, a => a);
//// [contextuallyTypeCommaOperator01.js]
var x;
x = (100, function (a) { return a; });

View file

@ -0,0 +1,10 @@
=== tests/cases/conformance/types/contextualTypes/commaOperator/contextuallyTypeCommaOperator01.ts ===
let x: (a: string) => string;
>x : Symbol(x, Decl(contextuallyTypeCommaOperator01.ts, 0, 3))
>a : Symbol(a, Decl(contextuallyTypeCommaOperator01.ts, 0, 8))
x = (100, a => a);
>x : Symbol(x, Decl(contextuallyTypeCommaOperator01.ts, 0, 3))
>a : Symbol(a, Decl(contextuallyTypeCommaOperator01.ts, 2, 9))
>a : Symbol(a, Decl(contextuallyTypeCommaOperator01.ts, 2, 9))

View file

@ -0,0 +1,15 @@
=== tests/cases/conformance/types/contextualTypes/commaOperator/contextuallyTypeCommaOperator01.ts ===
let x: (a: string) => string;
>x : (a: string) => string
>a : string
x = (100, a => a);
>x = (100, a => a) : (a: any) => any
>x : (a: string) => string
>(100, a => a) : (a: any) => any
>100, a => a : (a: any) => any
>100 : number
>a => a : (a: any) => any
>a : any
>a : any

View file

@ -0,0 +1,14 @@
tests/cases/conformance/types/contextualTypes/commaOperator/contextuallyTypeCommaOperator02.ts(3,1): error TS2322: Type '(a: any) => number' is not assignable to type '(a: string) => string'.
Type 'number' is not assignable to type 'string'.
==== tests/cases/conformance/types/contextualTypes/commaOperator/contextuallyTypeCommaOperator02.ts (1 errors) ====
let x: (a: string) => string;
x = (100, a => {
~
!!! error TS2322: Type '(a: any) => number' is not assignable to type '(a: string) => string'.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
const b: number = a;
return b;
});

View file

@ -0,0 +1,14 @@
//// [contextuallyTypeCommaOperator02.ts]
let x: (a: string) => string;
x = (100, a => {
const b: number = a;
return b;
});
//// [contextuallyTypeCommaOperator02.js]
var x;
x = (100, function (a) {
var b = a;
return b;
});

View file

@ -0,0 +1,10 @@
//// [contextuallyTypeLogicalAnd01.ts]
let x: (a: string) => string;
let y = true;
x = y && (a => a);
//// [contextuallyTypeLogicalAnd01.js]
var x;
var y = true;
x = y && (function (a) { return a; });

View file

@ -0,0 +1,14 @@
=== tests/cases/conformance/types/contextualTypes/logicalAnd/contextuallyTypeLogicalAnd01.ts ===
let x: (a: string) => string;
>x : Symbol(x, Decl(contextuallyTypeLogicalAnd01.ts, 0, 3))
>a : Symbol(a, Decl(contextuallyTypeLogicalAnd01.ts, 0, 8))
let y = true;
>y : Symbol(y, Decl(contextuallyTypeLogicalAnd01.ts, 1, 3))
x = y && (a => a);
>x : Symbol(x, Decl(contextuallyTypeLogicalAnd01.ts, 0, 3))
>y : Symbol(y, Decl(contextuallyTypeLogicalAnd01.ts, 1, 3))
>a : Symbol(a, Decl(contextuallyTypeLogicalAnd01.ts, 3, 10))
>a : Symbol(a, Decl(contextuallyTypeLogicalAnd01.ts, 3, 10))

View file

@ -0,0 +1,19 @@
=== tests/cases/conformance/types/contextualTypes/logicalAnd/contextuallyTypeLogicalAnd01.ts ===
let x: (a: string) => string;
>x : (a: string) => string
>a : string
let y = true;
>y : boolean
>true : boolean
x = y && (a => a);
>x = y && (a => a) : (a: any) => any
>x : (a: string) => string
>y && (a => a) : (a: any) => any
>y : boolean
>(a => a) : (a: any) => any
>a => a : (a: any) => any
>a : any
>a : any

View file

@ -0,0 +1,15 @@
tests/cases/conformance/types/contextualTypes/logicalAnd/contextuallyTypeLogicalAnd02.ts(4,1): error TS2322: Type '(a: any) => number' is not assignable to type '(a: string) => string'.
Type 'number' is not assignable to type 'string'.
==== tests/cases/conformance/types/contextualTypes/logicalAnd/contextuallyTypeLogicalAnd02.ts (1 errors) ====
let x: (a: string) => string;
let y = true;
x = y && (a => {
~
!!! error TS2322: Type '(a: any) => number' is not assignable to type '(a: string) => string'.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
const b: number = a;
return b;
});

View file

@ -0,0 +1,16 @@
//// [contextuallyTypeLogicalAnd02.ts]
let x: (a: string) => string;
let y = true;
x = y && (a => {
const b: number = a;
return b;
});
//// [contextuallyTypeLogicalAnd02.js]
var x;
var y = true;
x = y && (function (a) {
var b = a;
return b;
});