TypeScript/tests/baselines/reference/typesWithSpecializedCallSignatures.types

148 lines
10 KiB
Text
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== tests/cases/conformance/types/members/typesWithSpecializedCallSignatures.ts ===
// basic uses of specialized signatures without errors
class Base { foo: string }
2015-04-13 23:01:57 +02:00
>Base : Base, Symbol(Base, Decl(typesWithSpecializedCallSignatures.ts, 0, 0))
>foo : string, Symbol(foo, Decl(typesWithSpecializedCallSignatures.ts, 2, 12))
2014-08-15 23:33:16 +02:00
class Derived1 extends Base { bar: string }
2015-04-13 23:01:57 +02:00
>Derived1 : Derived1, Symbol(Derived1, Decl(typesWithSpecializedCallSignatures.ts, 2, 26))
>Base : Base, Symbol(Base, Decl(typesWithSpecializedCallSignatures.ts, 0, 0))
>bar : string, Symbol(bar, Decl(typesWithSpecializedCallSignatures.ts, 3, 29))
2014-08-15 23:33:16 +02:00
class Derived2 extends Base { baz: string }
2015-04-13 23:01:57 +02:00
>Derived2 : Derived2, Symbol(Derived2, Decl(typesWithSpecializedCallSignatures.ts, 3, 43))
>Base : Base, Symbol(Base, Decl(typesWithSpecializedCallSignatures.ts, 0, 0))
>baz : string, Symbol(baz, Decl(typesWithSpecializedCallSignatures.ts, 4, 29))
2014-08-15 23:33:16 +02:00
class C {
2015-04-13 23:01:57 +02:00
>C : C, Symbol(C, Decl(typesWithSpecializedCallSignatures.ts, 4, 43))
2014-08-15 23:33:16 +02:00
foo(x: 'hi'): Derived1;
2015-04-13 23:01:57 +02:00
>foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; }, Symbol(foo, Decl(typesWithSpecializedCallSignatures.ts, 6, 9), Decl(typesWithSpecializedCallSignatures.ts, 7, 27), Decl(typesWithSpecializedCallSignatures.ts, 8, 28), Decl(typesWithSpecializedCallSignatures.ts, 9, 25))
>x : 'hi', Symbol(x, Decl(typesWithSpecializedCallSignatures.ts, 7, 8))
>Derived1 : Derived1, Symbol(Derived1, Decl(typesWithSpecializedCallSignatures.ts, 2, 26))
2014-08-15 23:33:16 +02:00
foo(x: 'bye'): Derived2;
2015-04-13 23:01:57 +02:00
>foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; }, Symbol(foo, Decl(typesWithSpecializedCallSignatures.ts, 6, 9), Decl(typesWithSpecializedCallSignatures.ts, 7, 27), Decl(typesWithSpecializedCallSignatures.ts, 8, 28), Decl(typesWithSpecializedCallSignatures.ts, 9, 25))
>x : 'bye', Symbol(x, Decl(typesWithSpecializedCallSignatures.ts, 8, 8))
>Derived2 : Derived2, Symbol(Derived2, Decl(typesWithSpecializedCallSignatures.ts, 3, 43))
2014-08-15 23:33:16 +02:00
foo(x: string): Base;
2015-04-13 23:01:57 +02:00
>foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; }, Symbol(foo, Decl(typesWithSpecializedCallSignatures.ts, 6, 9), Decl(typesWithSpecializedCallSignatures.ts, 7, 27), Decl(typesWithSpecializedCallSignatures.ts, 8, 28), Decl(typesWithSpecializedCallSignatures.ts, 9, 25))
>x : string, Symbol(x, Decl(typesWithSpecializedCallSignatures.ts, 9, 8))
>Base : Base, Symbol(Base, Decl(typesWithSpecializedCallSignatures.ts, 0, 0))
2014-08-15 23:33:16 +02:00
foo(x) {
2015-04-13 23:01:57 +02:00
>foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; }, Symbol(foo, Decl(typesWithSpecializedCallSignatures.ts, 6, 9), Decl(typesWithSpecializedCallSignatures.ts, 7, 27), Decl(typesWithSpecializedCallSignatures.ts, 8, 28), Decl(typesWithSpecializedCallSignatures.ts, 9, 25))
>x : any, Symbol(x, Decl(typesWithSpecializedCallSignatures.ts, 10, 8))
2014-08-15 23:33:16 +02:00
return x;
2015-04-13 23:01:57 +02:00
>x : any, Symbol(x, Decl(typesWithSpecializedCallSignatures.ts, 10, 8))
2014-08-15 23:33:16 +02:00
}
}
var c = new C();
2015-04-13 23:01:57 +02:00
>c : C, Symbol(c, Decl(typesWithSpecializedCallSignatures.ts, 14, 3))
2014-08-15 23:33:16 +02:00
>new C() : C
2015-04-13 23:01:57 +02:00
>C : typeof C, Symbol(C, Decl(typesWithSpecializedCallSignatures.ts, 4, 43))
2014-08-15 23:33:16 +02:00
interface I {
2015-04-13 23:01:57 +02:00
>I : I, Symbol(I, Decl(typesWithSpecializedCallSignatures.ts, 14, 16))
2014-08-15 23:33:16 +02:00
foo(x: 'hi'): Derived1;
2015-04-13 23:01:57 +02:00
>foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; }, Symbol(foo, Decl(typesWithSpecializedCallSignatures.ts, 16, 13), Decl(typesWithSpecializedCallSignatures.ts, 17, 27), Decl(typesWithSpecializedCallSignatures.ts, 18, 28))
>x : 'hi', Symbol(x, Decl(typesWithSpecializedCallSignatures.ts, 17, 8))
>Derived1 : Derived1, Symbol(Derived1, Decl(typesWithSpecializedCallSignatures.ts, 2, 26))
2014-08-15 23:33:16 +02:00
foo(x: 'bye'): Derived2;
2015-04-13 23:01:57 +02:00
>foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; }, Symbol(foo, Decl(typesWithSpecializedCallSignatures.ts, 16, 13), Decl(typesWithSpecializedCallSignatures.ts, 17, 27), Decl(typesWithSpecializedCallSignatures.ts, 18, 28))
>x : 'bye', Symbol(x, Decl(typesWithSpecializedCallSignatures.ts, 18, 8))
>Derived2 : Derived2, Symbol(Derived2, Decl(typesWithSpecializedCallSignatures.ts, 3, 43))
2014-08-15 23:33:16 +02:00
foo(x: string): Base;
2015-04-13 23:01:57 +02:00
>foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; }, Symbol(foo, Decl(typesWithSpecializedCallSignatures.ts, 16, 13), Decl(typesWithSpecializedCallSignatures.ts, 17, 27), Decl(typesWithSpecializedCallSignatures.ts, 18, 28))
>x : string, Symbol(x, Decl(typesWithSpecializedCallSignatures.ts, 19, 8))
>Base : Base, Symbol(Base, Decl(typesWithSpecializedCallSignatures.ts, 0, 0))
2014-08-15 23:33:16 +02:00
}
var i: I;
2015-04-13 23:01:57 +02:00
>i : I, Symbol(i, Decl(typesWithSpecializedCallSignatures.ts, 21, 3))
>I : I, Symbol(I, Decl(typesWithSpecializedCallSignatures.ts, 14, 16))
2014-08-15 23:33:16 +02:00
var a: {
2015-04-13 23:01:57 +02:00
>a : { foo(x: 'hi'): Derived1; foo(x: 'bye'): Derived2; foo(x: string): Base; }, Symbol(a, Decl(typesWithSpecializedCallSignatures.ts, 23, 3))
2014-08-15 23:33:16 +02:00
foo(x: 'hi'): Derived1;
2015-04-13 23:01:57 +02:00
>foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; }, Symbol(foo, Decl(typesWithSpecializedCallSignatures.ts, 23, 8), Decl(typesWithSpecializedCallSignatures.ts, 24, 27), Decl(typesWithSpecializedCallSignatures.ts, 25, 28))
>x : 'hi', Symbol(x, Decl(typesWithSpecializedCallSignatures.ts, 24, 8))
>Derived1 : Derived1, Symbol(Derived1, Decl(typesWithSpecializedCallSignatures.ts, 2, 26))
2014-08-15 23:33:16 +02:00
foo(x: 'bye'): Derived2;
2015-04-13 23:01:57 +02:00
>foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; }, Symbol(foo, Decl(typesWithSpecializedCallSignatures.ts, 23, 8), Decl(typesWithSpecializedCallSignatures.ts, 24, 27), Decl(typesWithSpecializedCallSignatures.ts, 25, 28))
>x : 'bye', Symbol(x, Decl(typesWithSpecializedCallSignatures.ts, 25, 8))
>Derived2 : Derived2, Symbol(Derived2, Decl(typesWithSpecializedCallSignatures.ts, 3, 43))
2014-08-15 23:33:16 +02:00
foo(x: string): Base;
2015-04-13 23:01:57 +02:00
>foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; }, Symbol(foo, Decl(typesWithSpecializedCallSignatures.ts, 23, 8), Decl(typesWithSpecializedCallSignatures.ts, 24, 27), Decl(typesWithSpecializedCallSignatures.ts, 25, 28))
>x : string, Symbol(x, Decl(typesWithSpecializedCallSignatures.ts, 26, 8))
>Base : Base, Symbol(Base, Decl(typesWithSpecializedCallSignatures.ts, 0, 0))
2014-08-15 23:33:16 +02:00
};
c = i;
>c = i : I
2015-04-13 23:01:57 +02:00
>c : C, Symbol(c, Decl(typesWithSpecializedCallSignatures.ts, 14, 3))
>i : I, Symbol(i, Decl(typesWithSpecializedCallSignatures.ts, 21, 3))
2014-08-15 23:33:16 +02:00
c = a;
>c = a : { foo(x: 'hi'): Derived1; foo(x: 'bye'): Derived2; foo(x: string): Base; }
2015-04-13 23:01:57 +02:00
>c : C, Symbol(c, Decl(typesWithSpecializedCallSignatures.ts, 14, 3))
>a : { foo(x: 'hi'): Derived1; foo(x: 'bye'): Derived2; foo(x: string): Base; }, Symbol(a, Decl(typesWithSpecializedCallSignatures.ts, 23, 3))
2014-08-15 23:33:16 +02:00
i = c;
>i = c : C
2015-04-13 23:01:57 +02:00
>i : I, Symbol(i, Decl(typesWithSpecializedCallSignatures.ts, 21, 3))
>c : C, Symbol(c, Decl(typesWithSpecializedCallSignatures.ts, 14, 3))
2014-08-15 23:33:16 +02:00
i = a;
>i = a : { foo(x: 'hi'): Derived1; foo(x: 'bye'): Derived2; foo(x: string): Base; }
2015-04-13 23:01:57 +02:00
>i : I, Symbol(i, Decl(typesWithSpecializedCallSignatures.ts, 21, 3))
>a : { foo(x: 'hi'): Derived1; foo(x: 'bye'): Derived2; foo(x: string): Base; }, Symbol(a, Decl(typesWithSpecializedCallSignatures.ts, 23, 3))
2014-08-15 23:33:16 +02:00
a = c;
>a = c : C
2015-04-13 23:01:57 +02:00
>a : { foo(x: 'hi'): Derived1; foo(x: 'bye'): Derived2; foo(x: string): Base; }, Symbol(a, Decl(typesWithSpecializedCallSignatures.ts, 23, 3))
>c : C, Symbol(c, Decl(typesWithSpecializedCallSignatures.ts, 14, 3))
2014-08-15 23:33:16 +02:00
a = i;
>a = i : I
2015-04-13 23:01:57 +02:00
>a : { foo(x: 'hi'): Derived1; foo(x: 'bye'): Derived2; foo(x: string): Base; }, Symbol(a, Decl(typesWithSpecializedCallSignatures.ts, 23, 3))
>i : I, Symbol(i, Decl(typesWithSpecializedCallSignatures.ts, 21, 3))
2014-08-15 23:33:16 +02:00
var r1: Derived1 = c.foo('hi');
2015-04-13 23:01:57 +02:00
>r1 : Derived1, Symbol(r1, Decl(typesWithSpecializedCallSignatures.ts, 38, 3))
>Derived1 : Derived1, Symbol(Derived1, Decl(typesWithSpecializedCallSignatures.ts, 2, 26))
2014-08-15 23:33:16 +02:00
>c.foo('hi') : Derived1
2015-04-13 23:01:57 +02:00
>c.foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; }, Symbol(C.foo, Decl(typesWithSpecializedCallSignatures.ts, 6, 9), Decl(typesWithSpecializedCallSignatures.ts, 7, 27), Decl(typesWithSpecializedCallSignatures.ts, 8, 28), Decl(typesWithSpecializedCallSignatures.ts, 9, 25))
>c : C, Symbol(c, Decl(typesWithSpecializedCallSignatures.ts, 14, 3))
>foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; }, Symbol(C.foo, Decl(typesWithSpecializedCallSignatures.ts, 6, 9), Decl(typesWithSpecializedCallSignatures.ts, 7, 27), Decl(typesWithSpecializedCallSignatures.ts, 8, 28), Decl(typesWithSpecializedCallSignatures.ts, 9, 25))
2015-04-13 21:36:11 +02:00
>'hi' : string
2014-08-15 23:33:16 +02:00
var r2: Derived2 = c.foo('bye');
2015-04-13 23:01:57 +02:00
>r2 : Derived2, Symbol(r2, Decl(typesWithSpecializedCallSignatures.ts, 39, 3))
>Derived2 : Derived2, Symbol(Derived2, Decl(typesWithSpecializedCallSignatures.ts, 3, 43))
2014-08-15 23:33:16 +02:00
>c.foo('bye') : Derived2
2015-04-13 23:01:57 +02:00
>c.foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; }, Symbol(C.foo, Decl(typesWithSpecializedCallSignatures.ts, 6, 9), Decl(typesWithSpecializedCallSignatures.ts, 7, 27), Decl(typesWithSpecializedCallSignatures.ts, 8, 28), Decl(typesWithSpecializedCallSignatures.ts, 9, 25))
>c : C, Symbol(c, Decl(typesWithSpecializedCallSignatures.ts, 14, 3))
>foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; }, Symbol(C.foo, Decl(typesWithSpecializedCallSignatures.ts, 6, 9), Decl(typesWithSpecializedCallSignatures.ts, 7, 27), Decl(typesWithSpecializedCallSignatures.ts, 8, 28), Decl(typesWithSpecializedCallSignatures.ts, 9, 25))
2015-04-13 21:36:11 +02:00
>'bye' : string
2014-08-15 23:33:16 +02:00
var r3: Base = c.foo('hm');
2015-04-13 23:01:57 +02:00
>r3 : Base, Symbol(r3, Decl(typesWithSpecializedCallSignatures.ts, 40, 3))
>Base : Base, Symbol(Base, Decl(typesWithSpecializedCallSignatures.ts, 0, 0))
2014-08-15 23:33:16 +02:00
>c.foo('hm') : Base
2015-04-13 23:01:57 +02:00
>c.foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; }, Symbol(C.foo, Decl(typesWithSpecializedCallSignatures.ts, 6, 9), Decl(typesWithSpecializedCallSignatures.ts, 7, 27), Decl(typesWithSpecializedCallSignatures.ts, 8, 28), Decl(typesWithSpecializedCallSignatures.ts, 9, 25))
>c : C, Symbol(c, Decl(typesWithSpecializedCallSignatures.ts, 14, 3))
>foo : { (x: 'hi'): Derived1; (x: 'bye'): Derived2; (x: string): Base; }, Symbol(C.foo, Decl(typesWithSpecializedCallSignatures.ts, 6, 9), Decl(typesWithSpecializedCallSignatures.ts, 7, 27), Decl(typesWithSpecializedCallSignatures.ts, 8, 28), Decl(typesWithSpecializedCallSignatures.ts, 9, 25))
2015-04-13 21:36:11 +02:00
>'hm' : string
2014-08-15 23:33:16 +02:00