Accepted baselines.

This commit is contained in:
Daniel Rosenwasser
2016-09-03 01:10:07 -07:00
parent f3dcaae0f0
commit 1be4cee0c6
5 changed files with 812 additions and 0 deletions

View File

@@ -0,0 +1,76 @@
//// [derivedClassConstructorWithExplicitReturns01.ts]
class C {
cProp = 10;
foo() { return "this never gets used."; }
constructor(value: number) {
return {
cProp: value,
foo() {
return "well this looks kinda C-ish.";
}
}
}
}
class D extends C {
dProp = () => this;
constructor(a = 100) {
super(a);
if (Math.random() < 0.5) {
"You win!"
return {
cProp: 1,
dProp: () => this,
foo() { return "You win!!!!!" }
};
}
else
return null;
}
}
//// [derivedClassConstructorWithExplicitReturns01.js]
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var C = (function () {
function C(value) {
this.cProp = 10;
return {
cProp: value,
foo: function () {
return "well this looks kinda C-ish.";
}
};
}
C.prototype.foo = function () { return "this never gets used."; };
return C;
}());
var D = (function (_super) {
__extends(D, _super);
function D(a) {
if (a === void 0) { a = 100; }
var _this = _super.call(this, a) || this;
_this.dProp = function () { return _this; };
if (Math.random() < 0.5) {
"You win!";
return {
cProp: 1,
dProp: function () { return _this; },
foo: function () { return "You win!!!!!"; }
};
}
else
return null;
return _this;
}
return D;
}(C));
//# sourceMappingURL=derivedClassConstructorWithExplicitReturns01.js.map

View File

@@ -0,0 +1,2 @@
//// [derivedClassConstructorWithExplicitReturns01.js.map]
{"version":3,"file":"derivedClassConstructorWithExplicitReturns01.js","sourceRoot":"","sources":["derivedClassConstructorWithExplicitReturns01.ts"],"names":[],"mappings":";;;;;AACA;IAKI,WAAY,KAAa;QAJzB,UAAK,GAAG,EAAE,CAAC;QAKP,MAAM,CAAC;YACH,KAAK,EAAE,KAAK;YACZ,GAAG;gBACC,MAAM,CAAC,8BAA8B,CAAC;YAC1C,CAAC;SACJ,CAAA;IACL,CAAC;IATD,eAAG,GAAH,cAAQ,MAAM,CAAC,uBAAuB,CAAC,CAAC,CAAC;IAU7C,QAAC;AAAD,CAAC,AAbD,IAaC;AAED;IAAgB,qBAAC;IAGb,WAAY,CAAO;QAAP,kBAAA,EAAA,OAAO;QAAnB,YACI,kBAAM,CAAC,CAAC,SAYX;QAfD,WAAK,GAAG,cAAM,OAAA,KAAI,EAAJ,CAAI,CAAC;QAKf,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC;YACtB,UAAU,CAAA;YACV,MAAM,CAAC;gBACH,KAAK,EAAE,CAAC;gBACR,KAAK,EAAE,cAAM,OAAA,KAAI,EAAJ,CAAI;gBACjB,GAAG,gBAAK,MAAM,CAAC,cAAc,CAAA,CAAC,CAAC;aAClC,CAAC;QACN,CAAC;QACD,IAAI;YACA,MAAM,CAAC,IAAI,CAAC;;IACpB,CAAC;IACL,QAAC;AAAD,CAAC,AAjBD,CAAgB,CAAC,GAiBhB"}

View File

@@ -0,0 +1,583 @@
===================================================================
JsFile: derivedClassConstructorWithExplicitReturns01.js
mapUrl: derivedClassConstructorWithExplicitReturns01.js.map
sourceRoot:
sources: derivedClassConstructorWithExplicitReturns01.ts
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/derivedClassConstructorWithExplicitReturns01.js
sourceFile:derivedClassConstructorWithExplicitReturns01.ts
-------------------------------------------------------------------
>>>var __extends = (this && this.__extends) || function (d, b) {
>>> for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
>>> function __() { this.constructor = d; }
>>> d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
>>>};
>>>var C = (function () {
1 >
2 >^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
>
1 >Emitted(6, 1) Source(2, 1) + SourceIndex(0)
---
>>> function C(value) {
1->^^^^
2 > ^^^^^^^^^^^
3 > ^^^^^
4 > ^^^^^->
1->class C {
> cProp = 10;
>
> foo() { return "this never gets used."; }
>
>
2 > constructor(
3 > value: number
1->Emitted(7, 5) Source(7, 5) + SourceIndex(0)
2 >Emitted(7, 16) Source(7, 17) + SourceIndex(0)
3 >Emitted(7, 21) Source(7, 30) + SourceIndex(0)
---
>>> this.cProp = 10;
1->^^^^^^^^
2 > ^^^^^^^^^^
3 > ^^^
4 > ^^
5 > ^
1->
2 > cProp
3 > =
4 > 10
5 > ;
1->Emitted(8, 9) Source(3, 5) + SourceIndex(0)
2 >Emitted(8, 19) Source(3, 10) + SourceIndex(0)
3 >Emitted(8, 22) Source(3, 13) + SourceIndex(0)
4 >Emitted(8, 24) Source(3, 15) + SourceIndex(0)
5 >Emitted(8, 25) Source(3, 16) + SourceIndex(0)
---
>>> return {
1 >^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^^^^^^^^^^->
1 >
>
> foo() { return "this never gets used."; }
>
> constructor(value: number) {
>
2 > return
3 >
1 >Emitted(9, 9) Source(8, 9) + SourceIndex(0)
2 >Emitted(9, 15) Source(8, 15) + SourceIndex(0)
3 >Emitted(9, 16) Source(8, 16) + SourceIndex(0)
---
>>> cProp: value,
1->^^^^^^^^^^^^
2 > ^^^^^
3 > ^^
4 > ^^^^^
5 > ^^^^^^^->
1->{
>
2 > cProp
3 > :
4 > value
1->Emitted(10, 13) Source(9, 13) + SourceIndex(0)
2 >Emitted(10, 18) Source(9, 18) + SourceIndex(0)
3 >Emitted(10, 20) Source(9, 20) + SourceIndex(0)
4 >Emitted(10, 25) Source(9, 25) + SourceIndex(0)
---
>>> foo: function () {
1->^^^^^^^^^^^^
2 > ^^^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1->,
>
2 > foo
1->Emitted(11, 13) Source(10, 13) + SourceIndex(0)
2 >Emitted(11, 16) Source(10, 16) + SourceIndex(0)
---
>>> return "well this looks kinda C-ish.";
1->^^^^^^^^^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5 > ^
1->() {
>
2 > return
3 >
4 > "well this looks kinda C-ish."
5 > ;
1->Emitted(12, 17) Source(11, 17) + SourceIndex(0)
2 >Emitted(12, 23) Source(11, 23) + SourceIndex(0)
3 >Emitted(12, 24) Source(11, 24) + SourceIndex(0)
4 >Emitted(12, 54) Source(11, 54) + SourceIndex(0)
5 >Emitted(12, 55) Source(11, 55) + SourceIndex(0)
---
>>> }
1 >^^^^^^^^^^^^
2 > ^
1 >
>
2 > }
1 >Emitted(13, 13) Source(12, 13) + SourceIndex(0)
2 >Emitted(13, 14) Source(12, 14) + SourceIndex(0)
---
>>> };
1 >^^^^^^^^^
2 > ^
1 >
> }
2 >
1 >Emitted(14, 10) Source(13, 10) + SourceIndex(0)
2 >Emitted(14, 11) Source(13, 10) + SourceIndex(0)
---
>>> }
1 >^^^^
2 > ^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
>
2 > }
1 >Emitted(15, 5) Source(14, 5) + SourceIndex(0)
2 >Emitted(15, 6) Source(14, 6) + SourceIndex(0)
---
>>> C.prototype.foo = function () { return "this never gets used."; };
1->^^^^
2 > ^^^^^^^^^^^^^^^
3 > ^^^
4 > ^^^^^^^^^^^^^^
5 > ^^^^^^
6 > ^
7 > ^^^^^^^^^^^^^^^^^^^^^^^
8 > ^
9 > ^
10> ^
1->
2 > foo
3 >
4 > foo() {
5 > return
6 >
7 > "this never gets used."
8 > ;
9 >
10> }
1->Emitted(16, 5) Source(5, 5) + SourceIndex(0)
2 >Emitted(16, 20) Source(5, 8) + SourceIndex(0)
3 >Emitted(16, 23) Source(5, 5) + SourceIndex(0)
4 >Emitted(16, 37) Source(5, 13) + SourceIndex(0)
5 >Emitted(16, 43) Source(5, 19) + SourceIndex(0)
6 >Emitted(16, 44) Source(5, 20) + SourceIndex(0)
7 >Emitted(16, 67) Source(5, 43) + SourceIndex(0)
8 >Emitted(16, 68) Source(5, 44) + SourceIndex(0)
9 >Emitted(16, 69) Source(5, 45) + SourceIndex(0)
10>Emitted(16, 70) Source(5, 46) + SourceIndex(0)
---
>>> return C;
1 >^^^^
2 > ^^^^^^^^
1 >
>
> constructor(value: number) {
> return {
> cProp: value,
> foo() {
> return "well this looks kinda C-ish.";
> }
> }
> }
>
2 > }
1 >Emitted(17, 5) Source(15, 1) + SourceIndex(0)
2 >Emitted(17, 13) Source(15, 2) + SourceIndex(0)
---
>>>}());
1 >
2 >^
3 >
4 > ^^^^
5 > ^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
2 >}
3 >
4 > class C {
> cProp = 10;
>
> foo() { return "this never gets used."; }
>
> constructor(value: number) {
> return {
> cProp: value,
> foo() {
> return "well this looks kinda C-ish.";
> }
> }
> }
> }
1 >Emitted(18, 1) Source(15, 1) + SourceIndex(0)
2 >Emitted(18, 2) Source(15, 2) + SourceIndex(0)
3 >Emitted(18, 2) Source(2, 1) + SourceIndex(0)
4 >Emitted(18, 6) Source(15, 2) + SourceIndex(0)
---
>>>var D = (function (_super) {
1->
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^->
1->
>
>
1->Emitted(19, 1) Source(17, 1) + SourceIndex(0)
---
>>> __extends(D, _super);
1->^^^^
2 > ^^^^^^^^^^^^^^^^^^^^^
1->class D extends
2 > C
1->Emitted(20, 5) Source(17, 17) + SourceIndex(0)
2 >Emitted(20, 26) Source(17, 18) + SourceIndex(0)
---
>>> function D(a) {
1 >^^^^
2 > ^^^^^^^^^^^
3 > ^
4 > ^^^^^^^^^^^^^^^^^^^^^^^->
1 > {
> dProp = () => this;
>
>
2 > constructor(
3 > a = 100
1 >Emitted(21, 5) Source(20, 5) + SourceIndex(0)
2 >Emitted(21, 16) Source(20, 17) + SourceIndex(0)
3 >Emitted(21, 17) Source(20, 24) + SourceIndex(0)
---
>>> if (a === void 0) { a = 100; }
1->^^^^^^^^
2 > ^^^^^^^^^^^^^^^^^^
3 > ^^
4 > ^^^^^^^
5 > ^^^^^^^^^^^^^^^->
1->
2 >
3 >
4 > a = 100
1->Emitted(22, 9) Source(20, 17) + SourceIndex(0)
2 >Emitted(22, 27) Source(20, 17) + SourceIndex(0)
3 >Emitted(22, 29) Source(20, 17) + SourceIndex(0)
4 >Emitted(22, 36) Source(20, 24) + SourceIndex(0)
---
>>> var _this = _super.call(this, a) || this;
1->^^^^^^^^
2 > ^^^^^^^^^^^^
3 > ^^^^^^^^^^^^^^^^^^
4 > ^
5 > ^
6 > ^^^^^^^^^
7 > ^^^^->
1->
2 > constructor(a = 100) {
>
3 > super(
4 > a
5 > )
6 > ;
>
> if (Math.random() < 0.5) {
> "You win!"
> return {
> cProp: 1,
> dProp: () => this,
> foo() { return "You win!!!!!" }
> };
> }
> else
> return null;
> }
1->Emitted(23, 9) Source(20, 5) + SourceIndex(0)
2 >Emitted(23, 21) Source(21, 9) + SourceIndex(0)
3 >Emitted(23, 39) Source(21, 15) + SourceIndex(0)
4 >Emitted(23, 40) Source(21, 16) + SourceIndex(0)
5 >Emitted(23, 41) Source(21, 17) + SourceIndex(0)
6 >Emitted(23, 50) Source(33, 6) + SourceIndex(0)
---
>>> _this.dProp = function () { return _this; };
1->^^^^^^^^
2 > ^^^^^^^^^^^
3 > ^^^
4 > ^^^^^^^^^^^^^^
5 > ^^^^^^^
6 > ^^^^^
7 > ^^
8 > ^
9 > ^
1->
2 > dProp
3 > =
4 > () =>
5 >
6 > this
7 >
8 > this
9 > ;
1->Emitted(24, 9) Source(18, 5) + SourceIndex(0)
2 >Emitted(24, 20) Source(18, 10) + SourceIndex(0)
3 >Emitted(24, 23) Source(18, 13) + SourceIndex(0)
4 >Emitted(24, 37) Source(18, 19) + SourceIndex(0)
5 >Emitted(24, 44) Source(18, 19) + SourceIndex(0)
6 >Emitted(24, 49) Source(18, 23) + SourceIndex(0)
7 >Emitted(24, 51) Source(18, 19) + SourceIndex(0)
8 >Emitted(24, 52) Source(18, 23) + SourceIndex(0)
9 >Emitted(24, 53) Source(18, 24) + SourceIndex(0)
---
>>> if (Math.random() < 0.5) {
1 >^^^^^^^^
2 > ^^
3 > ^
4 > ^
5 > ^^^^
6 > ^
7 > ^^^^^^
8 > ^^
9 > ^^^
10> ^^^
11> ^
12> ^
13> ^
1 >
>
> constructor(a = 100) {
> super(a);
>
>
2 > if
3 >
4 > (
5 > Math
6 > .
7 > random
8 > ()
9 > <
10> 0.5
11> )
12>
13> {
1 >Emitted(25, 9) Source(23, 9) + SourceIndex(0)
2 >Emitted(25, 11) Source(23, 11) + SourceIndex(0)
3 >Emitted(25, 12) Source(23, 12) + SourceIndex(0)
4 >Emitted(25, 13) Source(23, 13) + SourceIndex(0)
5 >Emitted(25, 17) Source(23, 17) + SourceIndex(0)
6 >Emitted(25, 18) Source(23, 18) + SourceIndex(0)
7 >Emitted(25, 24) Source(23, 24) + SourceIndex(0)
8 >Emitted(25, 26) Source(23, 26) + SourceIndex(0)
9 >Emitted(25, 29) Source(23, 29) + SourceIndex(0)
10>Emitted(25, 32) Source(23, 32) + SourceIndex(0)
11>Emitted(25, 33) Source(23, 33) + SourceIndex(0)
12>Emitted(25, 34) Source(23, 34) + SourceIndex(0)
13>Emitted(25, 35) Source(23, 35) + SourceIndex(0)
---
>>> "You win!";
1 >^^^^^^^^^^^^
2 > ^^^^^^^^^^
3 > ^
1 >
>
2 > "You win!"
3 >
1 >Emitted(26, 13) Source(24, 13) + SourceIndex(0)
2 >Emitted(26, 23) Source(24, 23) + SourceIndex(0)
3 >Emitted(26, 24) Source(24, 23) + SourceIndex(0)
---
>>> return {
1 >^^^^^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^^^^^^->
1 >
>
2 > return
3 >
1 >Emitted(27, 13) Source(25, 13) + SourceIndex(0)
2 >Emitted(27, 19) Source(25, 19) + SourceIndex(0)
3 >Emitted(27, 20) Source(25, 20) + SourceIndex(0)
---
>>> cProp: 1,
1->^^^^^^^^^^^^^^^^
2 > ^^^^^
3 > ^^
4 > ^
5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1->{
>
2 > cProp
3 > :
4 > 1
1->Emitted(28, 17) Source(26, 17) + SourceIndex(0)
2 >Emitted(28, 22) Source(26, 22) + SourceIndex(0)
3 >Emitted(28, 24) Source(26, 24) + SourceIndex(0)
4 >Emitted(28, 25) Source(26, 25) + SourceIndex(0)
---
>>> dProp: function () { return _this; },
1->^^^^^^^^^^^^^^^^
2 > ^^^^^
3 > ^^
4 > ^^^^^^^^^^^^^^
5 > ^^^^^^^
6 > ^^^^^
7 > ^^
8 > ^
9 > ^^^^^^^^->
1->,
>
2 > dProp
3 > :
4 > () =>
5 >
6 > this
7 >
8 > this
1->Emitted(29, 17) Source(27, 17) + SourceIndex(0)
2 >Emitted(29, 22) Source(27, 22) + SourceIndex(0)
3 >Emitted(29, 24) Source(27, 24) + SourceIndex(0)
4 >Emitted(29, 38) Source(27, 30) + SourceIndex(0)
5 >Emitted(29, 45) Source(27, 30) + SourceIndex(0)
6 >Emitted(29, 50) Source(27, 34) + SourceIndex(0)
7 >Emitted(29, 52) Source(27, 30) + SourceIndex(0)
8 >Emitted(29, 53) Source(27, 34) + SourceIndex(0)
---
>>> foo: function () { return "You win!!!!!"; }
1->^^^^^^^^^^^^^^^^
2 > ^^^
3 > ^^^^^^^^^^^^^^^^
4 > ^^^^^^
5 > ^
6 > ^^^^^^^^^^^^^^
7 > ^
8 > ^
9 > ^
1->,
>
2 > foo
3 > () {
4 > return
5 >
6 > "You win!!!!!"
7 >
8 >
9 > }
1->Emitted(30, 17) Source(28, 17) + SourceIndex(0)
2 >Emitted(30, 20) Source(28, 20) + SourceIndex(0)
3 >Emitted(30, 36) Source(28, 25) + SourceIndex(0)
4 >Emitted(30, 42) Source(28, 31) + SourceIndex(0)
5 >Emitted(30, 43) Source(28, 32) + SourceIndex(0)
6 >Emitted(30, 57) Source(28, 46) + SourceIndex(0)
7 >Emitted(30, 58) Source(28, 46) + SourceIndex(0)
8 >Emitted(30, 59) Source(28, 47) + SourceIndex(0)
9 >Emitted(30, 60) Source(28, 48) + SourceIndex(0)
---
>>> };
1 >^^^^^^^^^^^^^
2 > ^
1 >
> }
2 > ;
1 >Emitted(31, 14) Source(29, 14) + SourceIndex(0)
2 >Emitted(31, 15) Source(29, 15) + SourceIndex(0)
---
>>> }
1 >^^^^^^^^
2 > ^
3 > ^^^^->
1 >
>
2 > }
1 >Emitted(32, 9) Source(30, 9) + SourceIndex(0)
2 >Emitted(32, 10) Source(30, 10) + SourceIndex(0)
---
>>> else
1->^^^^^^^^
2 > ^^^^
3 > ^^^^^^^^^^^^^->
1->
>
2 > else
1->Emitted(33, 9) Source(31, 9) + SourceIndex(0)
2 >Emitted(33, 13) Source(31, 13) + SourceIndex(0)
---
>>> return null;
1->^^^^^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^^^
5 > ^
1->
>
2 > return
3 >
4 > null
5 > ;
1->Emitted(34, 13) Source(32, 13) + SourceIndex(0)
2 >Emitted(34, 19) Source(32, 19) + SourceIndex(0)
3 >Emitted(34, 20) Source(32, 20) + SourceIndex(0)
4 >Emitted(34, 24) Source(32, 24) + SourceIndex(0)
5 >Emitted(34, 25) Source(32, 25) + SourceIndex(0)
---
>>> return _this;
>>> }
1 >^^^^
2 > ^
3 > ^^^^^^^^^->
1 >
>
2 > }
1 >Emitted(36, 5) Source(33, 5) + SourceIndex(0)
2 >Emitted(36, 6) Source(33, 6) + SourceIndex(0)
---
>>> return D;
1->^^^^
2 > ^^^^^^^^
1->
>
2 > }
1->Emitted(37, 5) Source(34, 1) + SourceIndex(0)
2 >Emitted(37, 13) Source(34, 2) + SourceIndex(0)
---
>>>}(C));
1 >
2 >^
3 >
4 > ^
5 > ^
6 > ^^^
7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
2 >}
3 >
4 > class D extends
5 > C
6 > {
> dProp = () => this;
>
> constructor(a = 100) {
> super(a);
>
> if (Math.random() < 0.5) {
> "You win!"
> return {
> cProp: 1,
> dProp: () => this,
> foo() { return "You win!!!!!" }
> };
> }
> else
> return null;
> }
> }
1 >Emitted(38, 1) Source(34, 1) + SourceIndex(0)
2 >Emitted(38, 2) Source(34, 2) + SourceIndex(0)
3 >Emitted(38, 2) Source(17, 1) + SourceIndex(0)
4 >Emitted(38, 3) Source(17, 17) + SourceIndex(0)
5 >Emitted(38, 4) Source(17, 18) + SourceIndex(0)
6 >Emitted(38, 7) Source(34, 2) + SourceIndex(0)
---
>>>//# sourceMappingURL=derivedClassConstructorWithExplicitReturns01.js.map

View File

@@ -0,0 +1,66 @@
=== tests/cases/compiler/derivedClassConstructorWithExplicitReturns01.ts ===
class C {
>C : Symbol(C, Decl(derivedClassConstructorWithExplicitReturns01.ts, 0, 0))
cProp = 10;
>cProp : Symbol(C.cProp, Decl(derivedClassConstructorWithExplicitReturns01.ts, 1, 9))
foo() { return "this never gets used."; }
>foo : Symbol(C.foo, Decl(derivedClassConstructorWithExplicitReturns01.ts, 2, 15))
constructor(value: number) {
>value : Symbol(value, Decl(derivedClassConstructorWithExplicitReturns01.ts, 6, 16))
return {
cProp: value,
>cProp : Symbol(cProp, Decl(derivedClassConstructorWithExplicitReturns01.ts, 7, 16))
>value : Symbol(value, Decl(derivedClassConstructorWithExplicitReturns01.ts, 6, 16))
foo() {
>foo : Symbol(foo, Decl(derivedClassConstructorWithExplicitReturns01.ts, 8, 25))
return "well this looks kinda C-ish.";
}
}
}
}
class D extends C {
>D : Symbol(D, Decl(derivedClassConstructorWithExplicitReturns01.ts, 14, 1))
>C : Symbol(C, Decl(derivedClassConstructorWithExplicitReturns01.ts, 0, 0))
dProp = () => this;
>dProp : Symbol(D.dProp, Decl(derivedClassConstructorWithExplicitReturns01.ts, 16, 19))
>this : Symbol(D, Decl(derivedClassConstructorWithExplicitReturns01.ts, 14, 1))
constructor(a = 100) {
>a : Symbol(a, Decl(derivedClassConstructorWithExplicitReturns01.ts, 19, 16))
super(a);
>super : Symbol(C, Decl(derivedClassConstructorWithExplicitReturns01.ts, 0, 0))
>a : Symbol(a, Decl(derivedClassConstructorWithExplicitReturns01.ts, 19, 16))
if (Math.random() < 0.5) {
>Math.random : Symbol(Math.random, Decl(lib.d.ts, --, --))
>Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>random : Symbol(Math.random, Decl(lib.d.ts, --, --))
"You win!"
return {
cProp: 1,
>cProp : Symbol(cProp, Decl(derivedClassConstructorWithExplicitReturns01.ts, 24, 20))
dProp: () => this,
>dProp : Symbol(dProp, Decl(derivedClassConstructorWithExplicitReturns01.ts, 25, 25))
>this : Symbol(D, Decl(derivedClassConstructorWithExplicitReturns01.ts, 14, 1))
foo() { return "You win!!!!!" }
>foo : Symbol(foo, Decl(derivedClassConstructorWithExplicitReturns01.ts, 26, 34))
};
}
else
return null;
}
}

View File

@@ -0,0 +1,85 @@
=== tests/cases/compiler/derivedClassConstructorWithExplicitReturns01.ts ===
class C {
>C : C
cProp = 10;
>cProp : number
>10 : number
foo() { return "this never gets used."; }
>foo : () => string
>"this never gets used." : string
constructor(value: number) {
>value : number
return {
>{ cProp: value, foo() { return "well this looks kinda C-ish."; } } : { cProp: number; foo(): string; }
cProp: value,
>cProp : number
>value : number
foo() {
>foo : () => string
return "well this looks kinda C-ish.";
>"well this looks kinda C-ish." : string
}
}
}
}
class D extends C {
>D : D
>C : C
dProp = () => this;
>dProp : () => this
>() => this : () => this
>this : this
constructor(a = 100) {
>a : number
>100 : number
super(a);
>super(a) : void
>super : typeof C
>a : number
if (Math.random() < 0.5) {
>Math.random() < 0.5 : boolean
>Math.random() : number
>Math.random : () => number
>Math : Math
>random : () => number
>0.5 : number
"You win!"
>"You win!" : string
return {
>{ cProp: 1, dProp: () => this, foo() { return "You win!!!!!" } } : { cProp: number; dProp: () => this; foo(): string; }
cProp: 1,
>cProp : number
>1 : number
dProp: () => this,
>dProp : () => this
>() => this : () => this
>this : this
foo() { return "You win!!!!!" }
>foo : () => string
>"You win!!!!!" : string
};
}
else
return null;
>null : null
}
}