183 lines
10 KiB
Text
183 lines
10 KiB
Text
=== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithOptionalParameters2.ts ===
|
|
// Optional parameters should be valid in all the below casts
|
|
|
|
function foo(x?: number);
|
|
>foo : Symbol(foo, Decl(callSignaturesWithOptionalParameters2.ts, 0, 0), Decl(callSignaturesWithOptionalParameters2.ts, 2, 25))
|
|
>x : Symbol(x, Decl(callSignaturesWithOptionalParameters2.ts, 2, 13))
|
|
|
|
function foo(x?: number) { }
|
|
>foo : Symbol(foo, Decl(callSignaturesWithOptionalParameters2.ts, 0, 0), Decl(callSignaturesWithOptionalParameters2.ts, 2, 25))
|
|
>x : Symbol(x, Decl(callSignaturesWithOptionalParameters2.ts, 3, 13))
|
|
|
|
foo(1);
|
|
>foo : Symbol(foo, Decl(callSignaturesWithOptionalParameters2.ts, 0, 0), Decl(callSignaturesWithOptionalParameters2.ts, 2, 25))
|
|
|
|
foo();
|
|
>foo : Symbol(foo, Decl(callSignaturesWithOptionalParameters2.ts, 0, 0), Decl(callSignaturesWithOptionalParameters2.ts, 2, 25))
|
|
|
|
function foo2(x: number);
|
|
>foo2 : Symbol(foo2, Decl(callSignaturesWithOptionalParameters2.ts, 6, 6), Decl(callSignaturesWithOptionalParameters2.ts, 8, 25), Decl(callSignaturesWithOptionalParameters2.ts, 9, 37))
|
|
>x : Symbol(x, Decl(callSignaturesWithOptionalParameters2.ts, 8, 14))
|
|
|
|
function foo2(x: number, y?: number);
|
|
>foo2 : Symbol(foo2, Decl(callSignaturesWithOptionalParameters2.ts, 6, 6), Decl(callSignaturesWithOptionalParameters2.ts, 8, 25), Decl(callSignaturesWithOptionalParameters2.ts, 9, 37))
|
|
>x : Symbol(x, Decl(callSignaturesWithOptionalParameters2.ts, 9, 14))
|
|
>y : Symbol(y, Decl(callSignaturesWithOptionalParameters2.ts, 9, 24))
|
|
|
|
function foo2(x: number, y?: number) { }
|
|
>foo2 : Symbol(foo2, Decl(callSignaturesWithOptionalParameters2.ts, 6, 6), Decl(callSignaturesWithOptionalParameters2.ts, 8, 25), Decl(callSignaturesWithOptionalParameters2.ts, 9, 37))
|
|
>x : Symbol(x, Decl(callSignaturesWithOptionalParameters2.ts, 10, 14))
|
|
>y : Symbol(y, Decl(callSignaturesWithOptionalParameters2.ts, 10, 24))
|
|
|
|
foo2(1);
|
|
>foo2 : Symbol(foo2, Decl(callSignaturesWithOptionalParameters2.ts, 6, 6), Decl(callSignaturesWithOptionalParameters2.ts, 8, 25), Decl(callSignaturesWithOptionalParameters2.ts, 9, 37))
|
|
|
|
foo2(1, 2);
|
|
>foo2 : Symbol(foo2, Decl(callSignaturesWithOptionalParameters2.ts, 6, 6), Decl(callSignaturesWithOptionalParameters2.ts, 8, 25), Decl(callSignaturesWithOptionalParameters2.ts, 9, 37))
|
|
|
|
class C {
|
|
>C : Symbol(C, Decl(callSignaturesWithOptionalParameters2.ts, 13, 11))
|
|
|
|
foo(x?: number);
|
|
>foo : Symbol(foo, Decl(callSignaturesWithOptionalParameters2.ts, 15, 9), Decl(callSignaturesWithOptionalParameters2.ts, 16, 20))
|
|
>x : Symbol(x, Decl(callSignaturesWithOptionalParameters2.ts, 16, 8))
|
|
|
|
foo(x?: number) { }
|
|
>foo : Symbol(foo, Decl(callSignaturesWithOptionalParameters2.ts, 15, 9), Decl(callSignaturesWithOptionalParameters2.ts, 16, 20))
|
|
>x : Symbol(x, Decl(callSignaturesWithOptionalParameters2.ts, 17, 8))
|
|
|
|
foo2(x: number);
|
|
>foo2 : Symbol(foo2, Decl(callSignaturesWithOptionalParameters2.ts, 17, 23), Decl(callSignaturesWithOptionalParameters2.ts, 19, 20), Decl(callSignaturesWithOptionalParameters2.ts, 20, 32))
|
|
>x : Symbol(x, Decl(callSignaturesWithOptionalParameters2.ts, 19, 9))
|
|
|
|
foo2(x: number, y?: number);
|
|
>foo2 : Symbol(foo2, Decl(callSignaturesWithOptionalParameters2.ts, 17, 23), Decl(callSignaturesWithOptionalParameters2.ts, 19, 20), Decl(callSignaturesWithOptionalParameters2.ts, 20, 32))
|
|
>x : Symbol(x, Decl(callSignaturesWithOptionalParameters2.ts, 20, 9))
|
|
>y : Symbol(y, Decl(callSignaturesWithOptionalParameters2.ts, 20, 19))
|
|
|
|
foo2(x: number, y?: number) { }
|
|
>foo2 : Symbol(foo2, Decl(callSignaturesWithOptionalParameters2.ts, 17, 23), Decl(callSignaturesWithOptionalParameters2.ts, 19, 20), Decl(callSignaturesWithOptionalParameters2.ts, 20, 32))
|
|
>x : Symbol(x, Decl(callSignaturesWithOptionalParameters2.ts, 21, 9))
|
|
>y : Symbol(y, Decl(callSignaturesWithOptionalParameters2.ts, 21, 19))
|
|
}
|
|
|
|
var c: C;
|
|
>c : Symbol(c, Decl(callSignaturesWithOptionalParameters2.ts, 24, 3))
|
|
>C : Symbol(C, Decl(callSignaturesWithOptionalParameters2.ts, 13, 11))
|
|
|
|
c.foo();
|
|
>c.foo : Symbol(C.foo, Decl(callSignaturesWithOptionalParameters2.ts, 15, 9), Decl(callSignaturesWithOptionalParameters2.ts, 16, 20))
|
|
>c : Symbol(c, Decl(callSignaturesWithOptionalParameters2.ts, 24, 3))
|
|
>foo : Symbol(C.foo, Decl(callSignaturesWithOptionalParameters2.ts, 15, 9), Decl(callSignaturesWithOptionalParameters2.ts, 16, 20))
|
|
|
|
c.foo(1);
|
|
>c.foo : Symbol(C.foo, Decl(callSignaturesWithOptionalParameters2.ts, 15, 9), Decl(callSignaturesWithOptionalParameters2.ts, 16, 20))
|
|
>c : Symbol(c, Decl(callSignaturesWithOptionalParameters2.ts, 24, 3))
|
|
>foo : Symbol(C.foo, Decl(callSignaturesWithOptionalParameters2.ts, 15, 9), Decl(callSignaturesWithOptionalParameters2.ts, 16, 20))
|
|
|
|
c.foo2(1);
|
|
>c.foo2 : Symbol(C.foo2, Decl(callSignaturesWithOptionalParameters2.ts, 17, 23), Decl(callSignaturesWithOptionalParameters2.ts, 19, 20), Decl(callSignaturesWithOptionalParameters2.ts, 20, 32))
|
|
>c : Symbol(c, Decl(callSignaturesWithOptionalParameters2.ts, 24, 3))
|
|
>foo2 : Symbol(C.foo2, Decl(callSignaturesWithOptionalParameters2.ts, 17, 23), Decl(callSignaturesWithOptionalParameters2.ts, 19, 20), Decl(callSignaturesWithOptionalParameters2.ts, 20, 32))
|
|
|
|
c.foo2(1, 2);
|
|
>c.foo2 : Symbol(C.foo2, Decl(callSignaturesWithOptionalParameters2.ts, 17, 23), Decl(callSignaturesWithOptionalParameters2.ts, 19, 20), Decl(callSignaturesWithOptionalParameters2.ts, 20, 32))
|
|
>c : Symbol(c, Decl(callSignaturesWithOptionalParameters2.ts, 24, 3))
|
|
>foo2 : Symbol(C.foo2, Decl(callSignaturesWithOptionalParameters2.ts, 17, 23), Decl(callSignaturesWithOptionalParameters2.ts, 19, 20), Decl(callSignaturesWithOptionalParameters2.ts, 20, 32))
|
|
|
|
interface I {
|
|
>I : Symbol(I, Decl(callSignaturesWithOptionalParameters2.ts, 29, 13))
|
|
|
|
(x?: number);
|
|
>x : Symbol(x, Decl(callSignaturesWithOptionalParameters2.ts, 32, 5))
|
|
|
|
(x?: number, y?: number);
|
|
>x : Symbol(x, Decl(callSignaturesWithOptionalParameters2.ts, 33, 5))
|
|
>y : Symbol(y, Decl(callSignaturesWithOptionalParameters2.ts, 33, 16))
|
|
|
|
foo(x: number, y?: number);
|
|
>foo : Symbol(foo, Decl(callSignaturesWithOptionalParameters2.ts, 33, 29), Decl(callSignaturesWithOptionalParameters2.ts, 34, 31))
|
|
>x : Symbol(x, Decl(callSignaturesWithOptionalParameters2.ts, 34, 8))
|
|
>y : Symbol(y, Decl(callSignaturesWithOptionalParameters2.ts, 34, 18))
|
|
|
|
foo(x: number, y?: number, z?: number);
|
|
>foo : Symbol(foo, Decl(callSignaturesWithOptionalParameters2.ts, 33, 29), Decl(callSignaturesWithOptionalParameters2.ts, 34, 31))
|
|
>x : Symbol(x, Decl(callSignaturesWithOptionalParameters2.ts, 35, 8))
|
|
>y : Symbol(y, Decl(callSignaturesWithOptionalParameters2.ts, 35, 18))
|
|
>z : Symbol(z, Decl(callSignaturesWithOptionalParameters2.ts, 35, 30))
|
|
}
|
|
|
|
var i: I;
|
|
>i : Symbol(i, Decl(callSignaturesWithOptionalParameters2.ts, 38, 3))
|
|
>I : Symbol(I, Decl(callSignaturesWithOptionalParameters2.ts, 29, 13))
|
|
|
|
i();
|
|
>i : Symbol(i, Decl(callSignaturesWithOptionalParameters2.ts, 38, 3))
|
|
|
|
i(1);
|
|
>i : Symbol(i, Decl(callSignaturesWithOptionalParameters2.ts, 38, 3))
|
|
|
|
i(1, 2);
|
|
>i : Symbol(i, Decl(callSignaturesWithOptionalParameters2.ts, 38, 3))
|
|
|
|
i.foo(1);
|
|
>i.foo : Symbol(I.foo, Decl(callSignaturesWithOptionalParameters2.ts, 33, 29), Decl(callSignaturesWithOptionalParameters2.ts, 34, 31))
|
|
>i : Symbol(i, Decl(callSignaturesWithOptionalParameters2.ts, 38, 3))
|
|
>foo : Symbol(I.foo, Decl(callSignaturesWithOptionalParameters2.ts, 33, 29), Decl(callSignaturesWithOptionalParameters2.ts, 34, 31))
|
|
|
|
i.foo(1, 2);
|
|
>i.foo : Symbol(I.foo, Decl(callSignaturesWithOptionalParameters2.ts, 33, 29), Decl(callSignaturesWithOptionalParameters2.ts, 34, 31))
|
|
>i : Symbol(i, Decl(callSignaturesWithOptionalParameters2.ts, 38, 3))
|
|
>foo : Symbol(I.foo, Decl(callSignaturesWithOptionalParameters2.ts, 33, 29), Decl(callSignaturesWithOptionalParameters2.ts, 34, 31))
|
|
|
|
i.foo(1, 2, 3);
|
|
>i.foo : Symbol(I.foo, Decl(callSignaturesWithOptionalParameters2.ts, 33, 29), Decl(callSignaturesWithOptionalParameters2.ts, 34, 31))
|
|
>i : Symbol(i, Decl(callSignaturesWithOptionalParameters2.ts, 38, 3))
|
|
>foo : Symbol(I.foo, Decl(callSignaturesWithOptionalParameters2.ts, 33, 29), Decl(callSignaturesWithOptionalParameters2.ts, 34, 31))
|
|
|
|
var a: {
|
|
>a : Symbol(a, Decl(callSignaturesWithOptionalParameters2.ts, 46, 3))
|
|
|
|
(x?: number);
|
|
>x : Symbol(x, Decl(callSignaturesWithOptionalParameters2.ts, 47, 5))
|
|
|
|
(x?: number, y?: number);
|
|
>x : Symbol(x, Decl(callSignaturesWithOptionalParameters2.ts, 48, 5))
|
|
>y : Symbol(y, Decl(callSignaturesWithOptionalParameters2.ts, 48, 16))
|
|
|
|
foo(x: number, y?: number);
|
|
>foo : Symbol(foo, Decl(callSignaturesWithOptionalParameters2.ts, 48, 29), Decl(callSignaturesWithOptionalParameters2.ts, 49, 31))
|
|
>x : Symbol(x, Decl(callSignaturesWithOptionalParameters2.ts, 49, 8))
|
|
>y : Symbol(y, Decl(callSignaturesWithOptionalParameters2.ts, 49, 18))
|
|
|
|
foo(x: number, y?: number, z?: number);
|
|
>foo : Symbol(foo, Decl(callSignaturesWithOptionalParameters2.ts, 48, 29), Decl(callSignaturesWithOptionalParameters2.ts, 49, 31))
|
|
>x : Symbol(x, Decl(callSignaturesWithOptionalParameters2.ts, 50, 8))
|
|
>y : Symbol(y, Decl(callSignaturesWithOptionalParameters2.ts, 50, 18))
|
|
>z : Symbol(z, Decl(callSignaturesWithOptionalParameters2.ts, 50, 30))
|
|
}
|
|
|
|
a();
|
|
>a : Symbol(a, Decl(callSignaturesWithOptionalParameters2.ts, 46, 3))
|
|
|
|
a(1);
|
|
>a : Symbol(a, Decl(callSignaturesWithOptionalParameters2.ts, 46, 3))
|
|
|
|
a(1, 2);
|
|
>a : Symbol(a, Decl(callSignaturesWithOptionalParameters2.ts, 46, 3))
|
|
|
|
a.foo(1);
|
|
>a.foo : Symbol(foo, Decl(callSignaturesWithOptionalParameters2.ts, 48, 29), Decl(callSignaturesWithOptionalParameters2.ts, 49, 31))
|
|
>a : Symbol(a, Decl(callSignaturesWithOptionalParameters2.ts, 46, 3))
|
|
>foo : Symbol(foo, Decl(callSignaturesWithOptionalParameters2.ts, 48, 29), Decl(callSignaturesWithOptionalParameters2.ts, 49, 31))
|
|
|
|
a.foo(1, 2);
|
|
>a.foo : Symbol(foo, Decl(callSignaturesWithOptionalParameters2.ts, 48, 29), Decl(callSignaturesWithOptionalParameters2.ts, 49, 31))
|
|
>a : Symbol(a, Decl(callSignaturesWithOptionalParameters2.ts, 46, 3))
|
|
>foo : Symbol(foo, Decl(callSignaturesWithOptionalParameters2.ts, 48, 29), Decl(callSignaturesWithOptionalParameters2.ts, 49, 31))
|
|
|
|
a.foo(1, 2, 3);
|
|
>a.foo : Symbol(foo, Decl(callSignaturesWithOptionalParameters2.ts, 48, 29), Decl(callSignaturesWithOptionalParameters2.ts, 49, 31))
|
|
>a : Symbol(a, Decl(callSignaturesWithOptionalParameters2.ts, 46, 3))
|
|
>foo : Symbol(foo, Decl(callSignaturesWithOptionalParameters2.ts, 48, 29), Decl(callSignaturesWithOptionalParameters2.ts, 49, 31))
|
|
|