TypeScript/tests/baselines/reference/callSignaturesWithOptionalParameters.types

209 lines
9.4 KiB
Plaintext
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithOptionalParameters.ts ===
// Optional parameters should be valid in all the below casts
function foo(x?: number) { }
2015-04-13 23:01:57 +02:00
>foo : (x?: number) => void, Symbol(foo, Decl(callSignaturesWithOptionalParameters.ts, 0, 0))
>x : number, Symbol(x, Decl(callSignaturesWithOptionalParameters.ts, 2, 13))
2014-08-15 23:33:16 +02:00
var f = function foo(x?: number) { }
2015-04-13 23:01:57 +02:00
>f : (x?: number) => void, Symbol(f, Decl(callSignaturesWithOptionalParameters.ts, 3, 3))
2014-08-15 23:33:16 +02:00
>function foo(x?: number) { } : (x?: number) => void
2015-04-13 23:01:57 +02:00
>foo : (x?: number) => void, Symbol(foo, Decl(callSignaturesWithOptionalParameters.ts, 3, 7))
>x : number, Symbol(x, Decl(callSignaturesWithOptionalParameters.ts, 3, 21))
2014-08-15 23:33:16 +02:00
var f2 = (x: number, y?: number) => { }
2015-04-13 23:01:57 +02:00
>f2 : (x: number, y?: number) => void, Symbol(f2, Decl(callSignaturesWithOptionalParameters.ts, 4, 3))
2014-08-15 23:33:16 +02:00
>(x: number, y?: number) => { } : (x: number, y?: number) => void
2015-04-13 23:01:57 +02:00
>x : number, Symbol(x, Decl(callSignaturesWithOptionalParameters.ts, 4, 10))
>y : number, Symbol(y, Decl(callSignaturesWithOptionalParameters.ts, 4, 20))
2014-08-15 23:33:16 +02:00
foo(1);
>foo(1) : void
2015-04-13 23:01:57 +02:00
>foo : (x?: number) => void, Symbol(foo, Decl(callSignaturesWithOptionalParameters.ts, 0, 0))
2015-04-13 21:36:11 +02:00
>1 : number
2014-08-15 23:33:16 +02:00
foo();
>foo() : void
2015-04-13 23:01:57 +02:00
>foo : (x?: number) => void, Symbol(foo, Decl(callSignaturesWithOptionalParameters.ts, 0, 0))
2014-08-15 23:33:16 +02:00
f(1);
>f(1) : void
2015-04-13 23:01:57 +02:00
>f : (x?: number) => void, Symbol(f, Decl(callSignaturesWithOptionalParameters.ts, 3, 3))
2015-04-13 21:36:11 +02:00
>1 : number
2014-08-15 23:33:16 +02:00
f();
>f() : void
2015-04-13 23:01:57 +02:00
>f : (x?: number) => void, Symbol(f, Decl(callSignaturesWithOptionalParameters.ts, 3, 3))
2014-08-15 23:33:16 +02:00
f2(1);
>f2(1) : void
2015-04-13 23:01:57 +02:00
>f2 : (x: number, y?: number) => void, Symbol(f2, Decl(callSignaturesWithOptionalParameters.ts, 4, 3))
2015-04-13 21:36:11 +02:00
>1 : number
2014-08-15 23:33:16 +02:00
f2(1, 2);
>f2(1, 2) : void
2015-04-13 23:01:57 +02:00
>f2 : (x: number, y?: number) => void, Symbol(f2, Decl(callSignaturesWithOptionalParameters.ts, 4, 3))
2015-04-13 21:36:11 +02:00
>1 : number
>2 : number
2014-08-15 23:33:16 +02:00
class C {
2015-04-13 23:01:57 +02:00
>C : C, Symbol(C, Decl(callSignaturesWithOptionalParameters.ts, 11, 9))
2014-08-15 23:33:16 +02:00
foo(x?: number) { }
2015-04-13 23:01:57 +02:00
>foo : (x?: number) => void, Symbol(foo, Decl(callSignaturesWithOptionalParameters.ts, 13, 9))
>x : number, Symbol(x, Decl(callSignaturesWithOptionalParameters.ts, 14, 8))
2014-08-15 23:33:16 +02:00
}
var c: C;
2015-04-13 23:01:57 +02:00
>c : C, Symbol(c, Decl(callSignaturesWithOptionalParameters.ts, 17, 3))
>C : C, Symbol(C, Decl(callSignaturesWithOptionalParameters.ts, 11, 9))
2014-08-15 23:33:16 +02:00
c.foo();
>c.foo() : void
2015-04-13 23:01:57 +02:00
>c.foo : (x?: number) => void, Symbol(C.foo, Decl(callSignaturesWithOptionalParameters.ts, 13, 9))
>c : C, Symbol(c, Decl(callSignaturesWithOptionalParameters.ts, 17, 3))
>foo : (x?: number) => void, Symbol(C.foo, Decl(callSignaturesWithOptionalParameters.ts, 13, 9))
2014-08-15 23:33:16 +02:00
c.foo(1);
>c.foo(1) : void
2015-04-13 23:01:57 +02:00
>c.foo : (x?: number) => void, Symbol(C.foo, Decl(callSignaturesWithOptionalParameters.ts, 13, 9))
>c : C, Symbol(c, Decl(callSignaturesWithOptionalParameters.ts, 17, 3))
>foo : (x?: number) => void, Symbol(C.foo, Decl(callSignaturesWithOptionalParameters.ts, 13, 9))
2015-04-13 21:36:11 +02:00
>1 : number
2014-08-15 23:33:16 +02:00
interface I {
2015-04-13 23:01:57 +02:00
>I : I, Symbol(I, Decl(callSignaturesWithOptionalParameters.ts, 19, 9))
2014-08-15 23:33:16 +02:00
(x?: number);
2015-04-13 23:01:57 +02:00
>x : number, Symbol(x, Decl(callSignaturesWithOptionalParameters.ts, 22, 5))
2014-08-15 23:33:16 +02:00
foo(x: number, y?: number);
2015-04-13 23:01:57 +02:00
>foo : (x: number, y?: number) => any, Symbol(foo, Decl(callSignaturesWithOptionalParameters.ts, 22, 17))
>x : number, Symbol(x, Decl(callSignaturesWithOptionalParameters.ts, 23, 8))
>y : number, Symbol(y, Decl(callSignaturesWithOptionalParameters.ts, 23, 18))
2014-08-15 23:33:16 +02:00
}
var i: I;
2015-04-13 23:01:57 +02:00
>i : I, Symbol(i, Decl(callSignaturesWithOptionalParameters.ts, 26, 3))
>I : I, Symbol(I, Decl(callSignaturesWithOptionalParameters.ts, 19, 9))
2014-08-15 23:33:16 +02:00
i();
>i() : any
2015-04-13 23:01:57 +02:00
>i : I, Symbol(i, Decl(callSignaturesWithOptionalParameters.ts, 26, 3))
2014-08-15 23:33:16 +02:00
i(1);
>i(1) : any
2015-04-13 23:01:57 +02:00
>i : I, Symbol(i, Decl(callSignaturesWithOptionalParameters.ts, 26, 3))
2015-04-13 21:36:11 +02:00
>1 : number
2014-08-15 23:33:16 +02:00
i.foo(1);
>i.foo(1) : any
2015-04-13 23:01:57 +02:00
>i.foo : (x: number, y?: number) => any, Symbol(I.foo, Decl(callSignaturesWithOptionalParameters.ts, 22, 17))
>i : I, Symbol(i, Decl(callSignaturesWithOptionalParameters.ts, 26, 3))
>foo : (x: number, y?: number) => any, Symbol(I.foo, Decl(callSignaturesWithOptionalParameters.ts, 22, 17))
2015-04-13 21:36:11 +02:00
>1 : number
2014-08-15 23:33:16 +02:00
i.foo(1, 2);
>i.foo(1, 2) : any
2015-04-13 23:01:57 +02:00
>i.foo : (x: number, y?: number) => any, Symbol(I.foo, Decl(callSignaturesWithOptionalParameters.ts, 22, 17))
>i : I, Symbol(i, Decl(callSignaturesWithOptionalParameters.ts, 26, 3))
>foo : (x: number, y?: number) => any, Symbol(I.foo, Decl(callSignaturesWithOptionalParameters.ts, 22, 17))
2015-04-13 21:36:11 +02:00
>1 : number
>2 : number
2014-08-15 23:33:16 +02:00
var a: {
2015-04-13 23:01:57 +02:00
>a : { (x?: number): any; foo(x?: number): any; }, Symbol(a, Decl(callSignaturesWithOptionalParameters.ts, 32, 3))
2014-08-15 23:33:16 +02:00
(x?: number);
2015-04-13 23:01:57 +02:00
>x : number, Symbol(x, Decl(callSignaturesWithOptionalParameters.ts, 33, 5))
2014-08-15 23:33:16 +02:00
foo(x?: number);
2015-04-13 23:01:57 +02:00
>foo : (x?: number) => any, Symbol(foo, Decl(callSignaturesWithOptionalParameters.ts, 33, 17))
>x : number, Symbol(x, Decl(callSignaturesWithOptionalParameters.ts, 34, 8))
2014-08-15 23:33:16 +02:00
}
a();
>a() : any
2015-04-13 23:01:57 +02:00
>a : { (x?: number): any; foo(x?: number): any; }, Symbol(a, Decl(callSignaturesWithOptionalParameters.ts, 32, 3))
2014-08-15 23:33:16 +02:00
a(1);
>a(1) : any
2015-04-13 23:01:57 +02:00
>a : { (x?: number): any; foo(x?: number): any; }, Symbol(a, Decl(callSignaturesWithOptionalParameters.ts, 32, 3))
2015-04-13 21:36:11 +02:00
>1 : number
2014-08-15 23:33:16 +02:00
a.foo();
>a.foo() : any
2015-04-13 23:01:57 +02:00
>a.foo : (x?: number) => any, Symbol(foo, Decl(callSignaturesWithOptionalParameters.ts, 33, 17))
>a : { (x?: number): any; foo(x?: number): any; }, Symbol(a, Decl(callSignaturesWithOptionalParameters.ts, 32, 3))
>foo : (x?: number) => any, Symbol(foo, Decl(callSignaturesWithOptionalParameters.ts, 33, 17))
2014-08-15 23:33:16 +02:00
a.foo(1);
>a.foo(1) : any
2015-04-13 23:01:57 +02:00
>a.foo : (x?: number) => any, Symbol(foo, Decl(callSignaturesWithOptionalParameters.ts, 33, 17))
>a : { (x?: number): any; foo(x?: number): any; }, Symbol(a, Decl(callSignaturesWithOptionalParameters.ts, 32, 3))
>foo : (x?: number) => any, Symbol(foo, Decl(callSignaturesWithOptionalParameters.ts, 33, 17))
2015-04-13 21:36:11 +02:00
>1 : number
2014-08-15 23:33:16 +02:00
var b = {
2015-04-13 23:01:57 +02:00
>b : { foo(x?: number): void; a: (x: number, y?: number) => void; b: (x?: number) => void; }, Symbol(b, Decl(callSignaturesWithOptionalParameters.ts, 42, 3))
>{ foo(x?: number) { }, a: function foo(x: number, y?: number) { }, b: (x?: number) => { }} : { foo(x?: number): void; a: (x: number, y?: number) => void; b: (x?: number) => void; }
2014-08-15 23:33:16 +02:00
foo(x?: number) { },
2015-04-13 23:01:57 +02:00
>foo : (x?: number) => void, Symbol(foo, Decl(callSignaturesWithOptionalParameters.ts, 42, 9))
>x : number, Symbol(x, Decl(callSignaturesWithOptionalParameters.ts, 43, 8))
2014-08-15 23:33:16 +02:00
a: function foo(x: number, y?: number) { },
2015-04-13 23:01:57 +02:00
>a : (x: number, y?: number) => void, Symbol(a, Decl(callSignaturesWithOptionalParameters.ts, 43, 24))
2014-08-15 23:33:16 +02:00
>function foo(x: number, y?: number) { } : (x: number, y?: number) => void
2015-04-13 23:01:57 +02:00
>foo : (x: number, y?: number) => void, Symbol(foo, Decl(callSignaturesWithOptionalParameters.ts, 44, 6))
>x : number, Symbol(x, Decl(callSignaturesWithOptionalParameters.ts, 44, 20))
>y : number, Symbol(y, Decl(callSignaturesWithOptionalParameters.ts, 44, 30))
2014-08-15 23:33:16 +02:00
b: (x?: number) => { }
2015-04-13 23:01:57 +02:00
>b : (x?: number) => void, Symbol(b, Decl(callSignaturesWithOptionalParameters.ts, 44, 47))
2014-08-15 23:33:16 +02:00
>(x?: number) => { } : (x?: number) => void
2015-04-13 23:01:57 +02:00
>x : number, Symbol(x, Decl(callSignaturesWithOptionalParameters.ts, 45, 8))
2014-08-15 23:33:16 +02:00
}
b.foo();
>b.foo() : void
2015-04-13 23:01:57 +02:00
>b.foo : (x?: number) => void, Symbol(foo, Decl(callSignaturesWithOptionalParameters.ts, 42, 9))
>b : { foo(x?: number): void; a: (x: number, y?: number) => void; b: (x?: number) => void; }, Symbol(b, Decl(callSignaturesWithOptionalParameters.ts, 42, 3))
>foo : (x?: number) => void, Symbol(foo, Decl(callSignaturesWithOptionalParameters.ts, 42, 9))
2014-08-15 23:33:16 +02:00
b.foo(1);
>b.foo(1) : void
2015-04-13 23:01:57 +02:00
>b.foo : (x?: number) => void, Symbol(foo, Decl(callSignaturesWithOptionalParameters.ts, 42, 9))
>b : { foo(x?: number): void; a: (x: number, y?: number) => void; b: (x?: number) => void; }, Symbol(b, Decl(callSignaturesWithOptionalParameters.ts, 42, 3))
>foo : (x?: number) => void, Symbol(foo, Decl(callSignaturesWithOptionalParameters.ts, 42, 9))
2015-04-13 21:36:11 +02:00
>1 : number
2014-08-15 23:33:16 +02:00
b.a(1);
>b.a(1) : void
2015-04-13 23:01:57 +02:00
>b.a : (x: number, y?: number) => void, Symbol(a, Decl(callSignaturesWithOptionalParameters.ts, 43, 24))
>b : { foo(x?: number): void; a: (x: number, y?: number) => void; b: (x?: number) => void; }, Symbol(b, Decl(callSignaturesWithOptionalParameters.ts, 42, 3))
>a : (x: number, y?: number) => void, Symbol(a, Decl(callSignaturesWithOptionalParameters.ts, 43, 24))
2015-04-13 21:36:11 +02:00
>1 : number
2014-08-15 23:33:16 +02:00
b.a(1, 2);
>b.a(1, 2) : void
2015-04-13 23:01:57 +02:00
>b.a : (x: number, y?: number) => void, Symbol(a, Decl(callSignaturesWithOptionalParameters.ts, 43, 24))
>b : { foo(x?: number): void; a: (x: number, y?: number) => void; b: (x?: number) => void; }, Symbol(b, Decl(callSignaturesWithOptionalParameters.ts, 42, 3))
>a : (x: number, y?: number) => void, Symbol(a, Decl(callSignaturesWithOptionalParameters.ts, 43, 24))
2015-04-13 21:36:11 +02:00
>1 : number
>2 : number
2014-08-15 23:33:16 +02:00
b.b();
>b.b() : void
2015-04-13 23:01:57 +02:00
>b.b : (x?: number) => void, Symbol(b, Decl(callSignaturesWithOptionalParameters.ts, 44, 47))
>b : { foo(x?: number): void; a: (x: number, y?: number) => void; b: (x?: number) => void; }, Symbol(b, Decl(callSignaturesWithOptionalParameters.ts, 42, 3))
>b : (x?: number) => void, Symbol(b, Decl(callSignaturesWithOptionalParameters.ts, 44, 47))
2014-08-15 23:33:16 +02:00
b.b(1);
>b.b(1) : void
2015-04-13 23:01:57 +02:00
>b.b : (x?: number) => void, Symbol(b, Decl(callSignaturesWithOptionalParameters.ts, 44, 47))
>b : { foo(x?: number): void; a: (x: number, y?: number) => void; b: (x?: number) => void; }, Symbol(b, Decl(callSignaturesWithOptionalParameters.ts, 42, 3))
>b : (x?: number) => void, Symbol(b, Decl(callSignaturesWithOptionalParameters.ts, 44, 47))
2015-04-13 21:36:11 +02:00
>1 : number
2014-08-15 23:33:16 +02:00