TypeScript/tests/baselines/reference/voidFunctionAssignmentCompat.types

82 lines
4.1 KiB
Plaintext
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== tests/cases/compiler/voidFunctionAssignmentCompat.ts ===
var fa = function(): any { return 3; }
2015-04-13 23:01:57 +02:00
>fa : () => any, Symbol(fa, Decl(voidFunctionAssignmentCompat.ts, 0, 3))
2014-08-15 23:33:16 +02:00
>function(): any { return 3; } : () => any
2015-04-13 21:36:11 +02:00
>3 : number
2014-08-15 23:33:16 +02:00
fa = function() { } // should not work
>fa = function() { } : () => void
2015-04-13 23:01:57 +02:00
>fa : () => any, Symbol(fa, Decl(voidFunctionAssignmentCompat.ts, 0, 3))
2014-08-15 23:33:16 +02:00
>function() { } : () => void
var fv = function(): void {}
2015-04-13 23:01:57 +02:00
>fv : () => void, Symbol(fv, Decl(voidFunctionAssignmentCompat.ts, 3, 3))
2014-08-15 23:33:16 +02:00
>function(): void {} : () => void
fv = function() { return 0; } // should work
>fv = function() { return 0; } : () => number
2015-04-13 23:01:57 +02:00
>fv : () => void, Symbol(fv, Decl(voidFunctionAssignmentCompat.ts, 3, 3))
2014-08-15 23:33:16 +02:00
>function() { return 0; } : () => number
2015-04-13 21:36:11 +02:00
>0 : number
2014-08-15 23:33:16 +02:00
function execAny(callback:(val:any)=>any) { return callback(0) }
2015-04-13 23:01:57 +02:00
>execAny : (callback: (val: any) => any) => any, Symbol(execAny, Decl(voidFunctionAssignmentCompat.ts, 4, 29))
>callback : (val: any) => any, Symbol(callback, Decl(voidFunctionAssignmentCompat.ts, 6, 17))
>val : any, Symbol(val, Decl(voidFunctionAssignmentCompat.ts, 6, 27))
2014-08-15 23:33:16 +02:00
>callback(0) : any
2015-04-13 23:01:57 +02:00
>callback : (val: any) => any, Symbol(callback, Decl(voidFunctionAssignmentCompat.ts, 6, 17))
2015-04-13 21:36:11 +02:00
>0 : number
2014-08-15 23:33:16 +02:00
execAny(function () {}); // should work
>execAny(function () {}) : any
2015-04-13 23:01:57 +02:00
>execAny : (callback: (val: any) => any) => any, Symbol(execAny, Decl(voidFunctionAssignmentCompat.ts, 4, 29))
2014-08-15 23:33:16 +02:00
>function () {} : () => void
function execVoid(callback:(val:any)=>void) { callback(0); }
2015-04-13 23:01:57 +02:00
>execVoid : (callback: (val: any) => void) => void, Symbol(execVoid, Decl(voidFunctionAssignmentCompat.ts, 7, 24))
>callback : (val: any) => void, Symbol(callback, Decl(voidFunctionAssignmentCompat.ts, 9, 18))
>val : any, Symbol(val, Decl(voidFunctionAssignmentCompat.ts, 9, 28))
2014-08-15 23:33:16 +02:00
>callback(0) : void
2015-04-13 23:01:57 +02:00
>callback : (val: any) => void, Symbol(callback, Decl(voidFunctionAssignmentCompat.ts, 9, 18))
2015-04-13 21:36:11 +02:00
>0 : number
2014-08-15 23:33:16 +02:00
execVoid(function () {return 0;}); // should work
>execVoid(function () {return 0;}) : void
2015-04-13 23:01:57 +02:00
>execVoid : (callback: (val: any) => void) => void, Symbol(execVoid, Decl(voidFunctionAssignmentCompat.ts, 7, 24))
2014-08-15 23:33:16 +02:00
>function () {return 0;} : () => number
2015-04-13 21:36:11 +02:00
>0 : number
2014-08-15 23:33:16 +02:00
var fra: (v:any)=>any = function() { return function () {}; } // should work
2015-04-13 23:01:57 +02:00
>fra : (v: any) => any, Symbol(fra, Decl(voidFunctionAssignmentCompat.ts, 12, 3))
>v : any, Symbol(v, Decl(voidFunctionAssignmentCompat.ts, 12, 10))
2014-08-15 23:33:16 +02:00
>function() { return function () {}; } : () => () => void
>function () {} : () => void
var frv: (v:any)=>void = function() { return function () { return 0; } } // should work
2015-04-13 23:01:57 +02:00
>frv : (v: any) => void, Symbol(frv, Decl(voidFunctionAssignmentCompat.ts, 13, 3))
>v : any, Symbol(v, Decl(voidFunctionAssignmentCompat.ts, 13, 10))
2014-08-15 23:33:16 +02:00
>function() { return function () { return 0; } } : () => () => number
>function () { return 0; } : () => number
2015-04-13 21:36:11 +02:00
>0 : number
2014-08-15 23:33:16 +02:00
var fra3: (v:any)=>string = (function() { return function (v:string) {return v;}; })() // should work
2015-04-13 23:01:57 +02:00
>fra3 : (v: any) => string, Symbol(fra3, Decl(voidFunctionAssignmentCompat.ts, 15, 3))
>v : any, Symbol(v, Decl(voidFunctionAssignmentCompat.ts, 15, 11))
2014-08-15 23:33:16 +02:00
>(function() { return function (v:string) {return v;}; })() : (v: string) => string
>(function() { return function (v:string) {return v;}; }) : () => (v: string) => string
>function() { return function (v:string) {return v;}; } : () => (v: string) => string
>function (v:string) {return v;} : (v: string) => string
2015-04-13 23:01:57 +02:00
>v : string, Symbol(v, Decl(voidFunctionAssignmentCompat.ts, 15, 59))
>v : string, Symbol(v, Decl(voidFunctionAssignmentCompat.ts, 15, 59))
2014-08-15 23:33:16 +02:00
var frv3: (v:any)=>number = (function() { return function () { return 0; } })() // should work
2015-04-13 23:01:57 +02:00
>frv3 : (v: any) => number, Symbol(frv3, Decl(voidFunctionAssignmentCompat.ts, 16, 3))
>v : any, Symbol(v, Decl(voidFunctionAssignmentCompat.ts, 16, 11))
2014-08-15 23:33:16 +02:00
>(function() { return function () { return 0; } })() : () => number
>(function() { return function () { return 0; } }) : () => () => number
>function() { return function () { return 0; } } : () => () => number
>function () { return 0; } : () => number
2015-04-13 21:36:11 +02:00
>0 : number
2014-08-15 23:33:16 +02:00