1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
|
=== tests/cases/conformance/classes/constructorDeclarations/automaticConstructors/derivedClassWithoutExplicitConstructor3.ts ===
// automatic constructors with a class hieararchy of depth > 2
class Base {
>Base : Symbol(Base, Decl(derivedClassWithoutExplicitConstructor3.ts, 0, 0))
a = 1;
>a : Symbol(Base.a, Decl(derivedClassWithoutExplicitConstructor3.ts, 2, 12))
constructor(x: number) { this.a = x; }
>x : Symbol(x, Decl(derivedClassWithoutExplicitConstructor3.ts, 4, 16))
>this.a : Symbol(Base.a, Decl(derivedClassWithoutExplicitConstructor3.ts, 2, 12))
>this : Symbol(Base, Decl(derivedClassWithoutExplicitConstructor3.ts, 0, 0))
>a : Symbol(Base.a, Decl(derivedClassWithoutExplicitConstructor3.ts, 2, 12))
>x : Symbol(x, Decl(derivedClassWithoutExplicitConstructor3.ts, 4, 16))
}
class Derived extends Base {
>Derived : Symbol(Derived, Decl(derivedClassWithoutExplicitConstructor3.ts, 5, 1))
>Base : Symbol(Base, Decl(derivedClassWithoutExplicitConstructor3.ts, 0, 0))
b = '';
>b : Symbol(Derived.b, Decl(derivedClassWithoutExplicitConstructor3.ts, 7, 28))
constructor(y: string, z: string) {
>y : Symbol(y, Decl(derivedClassWithoutExplicitConstructor3.ts, 9, 16))
>z : Symbol(z, Decl(derivedClassWithoutExplicitConstructor3.ts, 9, 26))
super(2);
>super : Symbol(Base, Decl(derivedClassWithoutExplicitConstructor3.ts, 0, 0))
this.b = y;
>this.b : Symbol(Derived.b, Decl(derivedClassWithoutExplicitConstructor3.ts, 7, 28))
>this : Symbol(Derived, Decl(derivedClassWithoutExplicitConstructor3.ts, 5, 1))
>b : Symbol(Derived.b, Decl(derivedClassWithoutExplicitConstructor3.ts, 7, 28))
>y : Symbol(y, Decl(derivedClassWithoutExplicitConstructor3.ts, 9, 16))
}
}
class Derived2 extends Derived {
>Derived2 : Symbol(Derived2, Decl(derivedClassWithoutExplicitConstructor3.ts, 13, 1))
>Derived : Symbol(Derived, Decl(derivedClassWithoutExplicitConstructor3.ts, 5, 1))
x = 1
>x : Symbol(Derived2.x, Decl(derivedClassWithoutExplicitConstructor3.ts, 15, 32))
y = 'hello';
>y : Symbol(Derived2.y, Decl(derivedClassWithoutExplicitConstructor3.ts, 16, 9))
}
var r = new Derived(); // error
>r : Symbol(r, Decl(derivedClassWithoutExplicitConstructor3.ts, 20, 3))
>Derived : Symbol(Derived, Decl(derivedClassWithoutExplicitConstructor3.ts, 5, 1))
var r2 = new Derived2(1); // error
>r2 : Symbol(r2, Decl(derivedClassWithoutExplicitConstructor3.ts, 21, 3))
>Derived2 : Symbol(Derived2, Decl(derivedClassWithoutExplicitConstructor3.ts, 13, 1))
var r3 = new Derived('', '');
>r3 : Symbol(r3, Decl(derivedClassWithoutExplicitConstructor3.ts, 22, 3))
>Derived : Symbol(Derived, Decl(derivedClassWithoutExplicitConstructor3.ts, 5, 1))
class Base2<T> {
>Base2 : Symbol(Base2, Decl(derivedClassWithoutExplicitConstructor3.ts, 22, 29))
>T : Symbol(T, Decl(derivedClassWithoutExplicitConstructor3.ts, 24, 12))
a: T;
>a : Symbol(Base2.a, Decl(derivedClassWithoutExplicitConstructor3.ts, 24, 16))
>T : Symbol(T, Decl(derivedClassWithoutExplicitConstructor3.ts, 24, 12))
constructor(x: T) { this.a = x; }
>x : Symbol(x, Decl(derivedClassWithoutExplicitConstructor3.ts, 26, 16))
>T : Symbol(T, Decl(derivedClassWithoutExplicitConstructor3.ts, 24, 12))
>this.a : Symbol(Base2.a, Decl(derivedClassWithoutExplicitConstructor3.ts, 24, 16))
>this : Symbol(Base2, Decl(derivedClassWithoutExplicitConstructor3.ts, 22, 29))
>a : Symbol(Base2.a, Decl(derivedClassWithoutExplicitConstructor3.ts, 24, 16))
>x : Symbol(x, Decl(derivedClassWithoutExplicitConstructor3.ts, 26, 16))
}
class D<T> extends Base {
>D : Symbol(D, Decl(derivedClassWithoutExplicitConstructor3.ts, 27, 1))
>T : Symbol(T, Decl(derivedClassWithoutExplicitConstructor3.ts, 29, 8))
>Base : Symbol(Base, Decl(derivedClassWithoutExplicitConstructor3.ts, 0, 0))
b: T = null;
>b : Symbol(D.b, Decl(derivedClassWithoutExplicitConstructor3.ts, 29, 25))
>T : Symbol(T, Decl(derivedClassWithoutExplicitConstructor3.ts, 29, 8))
constructor(y: T, z: T) {
>y : Symbol(y, Decl(derivedClassWithoutExplicitConstructor3.ts, 31, 16))
>T : Symbol(T, Decl(derivedClassWithoutExplicitConstructor3.ts, 29, 8))
>z : Symbol(z, Decl(derivedClassWithoutExplicitConstructor3.ts, 31, 21))
>T : Symbol(T, Decl(derivedClassWithoutExplicitConstructor3.ts, 29, 8))
super(2);
>super : Symbol(Base, Decl(derivedClassWithoutExplicitConstructor3.ts, 0, 0))
this.b = y;
>this.b : Symbol(D.b, Decl(derivedClassWithoutExplicitConstructor3.ts, 29, 25))
>this : Symbol(D, Decl(derivedClassWithoutExplicitConstructor3.ts, 27, 1))
>b : Symbol(D.b, Decl(derivedClassWithoutExplicitConstructor3.ts, 29, 25))
>y : Symbol(y, Decl(derivedClassWithoutExplicitConstructor3.ts, 31, 16))
}
}
class D2<T extends Date> extends D<T> {
>D2 : Symbol(D2, Decl(derivedClassWithoutExplicitConstructor3.ts, 35, 1))
>T : Symbol(T, Decl(derivedClassWithoutExplicitConstructor3.ts, 38, 9))
>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --))
>D : Symbol(D, Decl(derivedClassWithoutExplicitConstructor3.ts, 27, 1))
>T : Symbol(T, Decl(derivedClassWithoutExplicitConstructor3.ts, 38, 9))
x = 2
>x : Symbol(D2.x, Decl(derivedClassWithoutExplicitConstructor3.ts, 38, 39))
y: T = null;
>y : Symbol(D2.y, Decl(derivedClassWithoutExplicitConstructor3.ts, 39, 9))
>T : Symbol(T, Decl(derivedClassWithoutExplicitConstructor3.ts, 38, 9))
}
var d = new D2(); // error
>d : Symbol(d, Decl(derivedClassWithoutExplicitConstructor3.ts, 43, 3))
>D2 : Symbol(D2, Decl(derivedClassWithoutExplicitConstructor3.ts, 35, 1))
var d2 = new D2(new Date()); // error
>d2 : Symbol(d2, Decl(derivedClassWithoutExplicitConstructor3.ts, 44, 3))
>D2 : Symbol(D2, Decl(derivedClassWithoutExplicitConstructor3.ts, 35, 1))
>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --))
var d3 = new D2(new Date(), new Date()); // ok
>d3 : Symbol(d3, Decl(derivedClassWithoutExplicitConstructor3.ts, 45, 3))
>D2 : Symbol(D2, Decl(derivedClassWithoutExplicitConstructor3.ts, 35, 1))
>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --))
>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --))
|