fix(44477): emit full path to access expressions in comments (#44545)

Co-authored-by: Wesley Wigham <wewigham@microsoft.com>
This commit is contained in:
Oleksandr T
2022-03-04 11:22:46 -08:00
committed by GitHub
co-authored by Wesley Wigham
parent 4abad556be
commit 5f9f9e3752
40 changed files with 253 additions and 257 deletions
+1 -5
View File
@@ -3368,13 +3368,9 @@ namespace ts {
const substitute = typeof constantValue === "string" ? factory.createStringLiteral(constantValue) : factory.createNumericLiteral(constantValue);
if (!compilerOptions.removeComments) {
const originalNode = getOriginalNode(node, isAccessExpression);
const propertyName = isPropertyAccessExpression(originalNode)
? declarationNameToString(originalNode.name)
: safeMultiLineComment(getTextOfNode(originalNode.argumentExpression));
addSyntheticTrailingComment(substitute, SyntaxKind.MultiLineCommentTrivia, ` ${propertyName} `);
addSyntheticTrailingComment(substitute, SyntaxKind.MultiLineCommentTrivia, ` ${safeMultiLineComment(getTextOfNode(originalNode))} `);
}
return substitute;
}
@@ -34,7 +34,7 @@ define(["require", "exports"], function (require, exports) {
function User() {
}
User.prototype.method = function (input) {
if (0 /* A */ === input) { }
if (0 /* CharCode.A */ === input) { }
};
return User;
}());
@@ -24,7 +24,7 @@ function foo(x) {
var y = x; // Ok
}
foo(5);
foo(0 /* A */);
foo(0 /* E.A */);
var A = /** @class */ (function () {
function A() {
}
@@ -18,5 +18,5 @@ function foo1() {
})(E || (E = {}));
}
function foo2() {
return 0 /* A */;
return 0 /* E.A */;
}
@@ -18,7 +18,7 @@ function foo1() {
})(E || (E = {}));
}
function foo2() {
return 0 /* A */;
return 0 /* E.A */;
var E;
(function (E) {
E[E["A"] = 0] = "A";
+2 -2
View File
@@ -14,7 +14,7 @@ f2('bar')
//// [constEnum3.js]
function f1(f) { }
function f2(f) { }
f1(0 /* foo */);
f1(1 /* bar */);
f1(0 /* TestType.foo */);
f1(1 /* TestType.bar */);
f2('foo');
f2('bar');
@@ -19,5 +19,5 @@ define(["require", "exports"], function (require, exports) {
define(["require", "exports"], function (require, exports) {
"use strict";
exports.__esModule = true;
var v = 100 /* V */;
var v = 100 /* A.V */;
});
@@ -29,7 +29,7 @@ exports.fooFunc = fooFunc;
exports.__esModule = true;
function check(x) {
switch (x) {
case 0 /* Some */:
case 0 /* Foo.ConstFooEnum.Some */:
break;
}
}
@@ -44,7 +44,7 @@ module.exports = Foo.ConstEnumOnlyModule;
exports.__esModule = true;
function check(x) {
switch (x) {
case 0 /* Some */:
case 0 /* Foo.ConstFooEnum.Some */:
break;
}
}
@@ -47,13 +47,13 @@ exports.__esModule = true;
//// [Usage1.js]
"use strict";
exports.__esModule = true;
0 /* Foo */;
0 /* Foo */;
0 /* MyConstEnum1.Foo */;
0 /* MyConstEnum2.Foo */;
//// [Usage2.js]
"use strict";
exports.__esModule = true;
0 /* Foo */;
0 /* MyConstEnum.Foo */;
//// [Usage3.js]
"use strict";
exports.__esModule = true;
0 /* Foo */;
0 /* MyConstEnum.Foo */;
@@ -23,6 +23,6 @@ StillEnum.Foo;
//// [usages.js]
"use strict";
exports.__esModule = true;
0 /* Foo */;
0 /* Foo */;
0 /* Foo */;
0 /* MyConstEnum.Foo */;
0 /* AlsoEnum.Foo */;
0 /* StillEnum.Foo */;
@@ -21,6 +21,6 @@ var Outer;
var B;
(function (B) {
var O = Outer;
var x = 0 /* X */;
var x = 0 /* O.A.X */;
var y = O.x;
})(B || (B = {}));
@@ -37,15 +37,15 @@ class C {
var o = {
1: true
};
var a = 1 /* A */;
var a1 = 1 /* "A" */;
var g = o[1 /* A */];
var a = 1 /* G.A */;
var a1 = 1 /* G["A"] */;
var g = o[1 /* G.A */];
class C {
[1 /* A */]() { }
get [2 /* B */]() {
[1 /* G.A */]() { }
get [2 /* G.B */]() {
return true;
}
set [2 /* B */](x) { }
set [2 /* G.B */](x) { }
}
@@ -25,11 +25,11 @@ G.B = 3;
// than a property access that selects one of the enum's members
// Error from referring constant enum in any other context than a property access
var z = G;
var z1 = G[1 /* A */];
var z1 = G[1 /* G.A */];
var g;
g = "string";
function foo(x) { }
2 /* B */ = 3;
2 /* G.B */ = 3;
//// [constEnumPropertyAccess2.d.ts]
@@ -24,13 +24,13 @@ function assert(x) {
}
function verify(a) {
switch (a) {
case 0 /* A */:
case 0 /* En.A */:
return assert(a);
case 1 /* "B" */:
case 1 /* En["B"] */:
return assert(a);
case 2 /* `C` */:
case 2 /* En[`C`] */:
return assert(a);
case 3 /* "\u{44}" */:
case 3 /* En["\u{44}"] */:
return assert(a);
}
}
@@ -23,15 +23,15 @@ let c1 = Foo["C"].toString();
//// [constEnumToStringWithComments.js]
var x0 = 100 /* X */.toString();
var x1 = 100 /* "X" */.toString();
var y0 = 0.5 /* Y */.toString();
var y1 = 0.5 /* "Y" */.toString();
var z0 = 2 /* Z */.toString();
var z1 = 2 /* "Z" */.toString();
var a0 = -1 /* A */.toString();
var a1 = -1 /* "A" */.toString();
var b0 = -1.5 /* B */.toString();
var b1 = -1.5 /* "B" */.toString();
var c0 = -1 /* C */.toString();
var c1 = -1 /* "C" */.toString();
var x0 = 100 /* Foo.X */.toString();
var x1 = 100 /* Foo["X"] */.toString();
var y0 = 0.5 /* Foo.Y */.toString();
var y1 = 0.5 /* Foo["Y"] */.toString();
var z0 = 2 /* Foo.Z */.toString();
var z1 = 2 /* Foo["Z"] */.toString();
var a0 = -1 /* Foo.A */.toString();
var a1 = -1 /* Foo["A"] */.toString();
var b0 = -1.5 /* Foo.B */.toString();
var b1 = -1.5 /* Foo["B"] */.toString();
var c0 = -1 /* Foo.C */.toString();
var c1 = -1 /* Foo["C"] */.toString();
+44 -44
View File
@@ -192,72 +192,72 @@ var A2;
})(A2 || (A2 = {}));
var I2 = A2.B;
function foo0(e) {
if (e === 1 /* V1 */) {
if (e === 1 /* I.V1 */) {
}
else if (e === 101 /* V2 */) {
else if (e === 101 /* I.V2 */) {
}
}
function foo1(e) {
if (e === 10 /* V1 */) {
if (e === 10 /* I1.C.E.V1 */) {
}
else if (e === 110 /* V2 */) {
else if (e === 110 /* I1.C.E.V2 */) {
}
}
function foo2(e) {
if (e === 10 /* V1 */) {
if (e === 10 /* I2.C.E.V1 */) {
}
else if (e === 110 /* V2 */) {
else if (e === 110 /* I2.C.E.V2 */) {
}
}
function foo(x) {
switch (x) {
case 0 /* A */:
case 1 /* B */:
case 10 /* C */:
case 1 /* D */:
case 1 /* E */:
case 1 /* F */:
case 1 /* G */:
case -2 /* H */:
case 0 /* I */:
case 0 /* J */:
case -6 /* K */:
case -2 /* L */:
case 2 /* M */:
case 2 /* N */:
case 0 /* O */:
case 0 /* P */:
case 1 /* PQ */:
case -1 /* Q */:
case 0 /* R */:
case 0 /* S */:
case 11 /* "T" */:
case 11 /* `U` */:
case 11 /* V */:
case 11 /* W */:
case 100 /* W1 */:
case 100 /* W2 */:
case 100 /* W3 */:
case 11 /* W4 */:
case 0 /* Enum1.A */:
case 1 /* Enum1.B */:
case 10 /* Enum1.C */:
case 1 /* Enum1.D */:
case 1 /* Enum1.E */:
case 1 /* Enum1.F */:
case 1 /* Enum1.G */:
case -2 /* Enum1.H */:
case 0 /* Enum1.I */:
case 0 /* Enum1.J */:
case -6 /* Enum1.K */:
case -2 /* Enum1.L */:
case 2 /* Enum1.M */:
case 2 /* Enum1.N */:
case 0 /* Enum1.O */:
case 0 /* Enum1.P */:
case 1 /* Enum1.PQ */:
case -1 /* Enum1.Q */:
case 0 /* Enum1.R */:
case 0 /* Enum1.S */:
case 11 /* Enum1["T"] */:
case 11 /* Enum1[`U`] */:
case 11 /* Enum1.V */:
case 11 /* Enum1.W */:
case 100 /* Enum1.W1 */:
case 100 /* Enum1.W2 */:
case 100 /* Enum1.W3 */:
case 11 /* Enum1.W4 */:
break;
}
}
function bar(e) {
switch (e) {
case 1 /* V1 */: return 1;
case 101 /* V2 */: return 1;
case 64 /* V3 */: return 1;
case 1 /* A.B.C.E.V1 */: return 1;
case 101 /* A.B.C.E.V2 */: return 1;
case 64 /* A.B.C.E.V3 */: return 1;
}
}
function baz(c) {
switch (c) {
case 0 /* "//" */:
case 1 /* "/*" */:
case 2 /* "*_/" */:
case 3 /* "///" */:
case 4 /* "#" */:
case 5 /* "<!--" */:
case 6 /* "-->" */:
case 0 /* Comments["//"] */:
case 1 /* Comments["/*"] */:
case 2 /* Comments["*_/"] */:
case 3 /* Comments["///"] */:
case 4 /* Comments["#"] */:
case 5 /* Comments["<!--"] */:
case 6 /* Comments["-->"] */:
break;
}
}
@@ -33,10 +33,10 @@ let n3 = test[numbersNotConst.one];
var test;
var s = test[0];
var n = test[1];
var s1 = test[0 /* zero */];
var n1 = test[1 /* one */];
var s2 = test[0 /* "zero" */];
var n2 = test[1 /* "one" */];
var s1 = test[0 /* numbers.zero */];
var n1 = test[1 /* numbers.one */];
var s2 = test[0 /* numbers["zero"] */];
var n2 = test[1 /* numbers["one"] */];
var numbersNotConst;
(function (numbersNotConst) {
numbersNotConst[numbersNotConst["zero"] = 0] = "zero";
@@ -76,10 +76,10 @@ var foo2 = { a: E2.a };
var foo3 = { a: E1.a };
var foo4 = { a: E2.a };
var foo5 = { a: E3.a };
var foo6 = { a: 0 /* a */ };
var foo6 = { a: 0 /* E4.a */ };
var foo7 = { a: E5.a };
var foo8 = { a: E1.a };
var foo9 = { a: E2.a };
var foo10 = { a: E3.a };
var foo11 = { a: 0 /* a */ };
var foo11 = { a: 0 /* E4.a */ };
var foo12 = { a: E5.a };
@@ -41,8 +41,8 @@ var A = /** @class */ (function () {
A.prototype.getA = function () {
var _a;
return _a = {},
_a["123123" /* Test1 */] = '123',
_a["12312312312" /* Test2 */] = '123',
_a["123123" /* TestEnum.Test1 */] = '123',
_a["12312312312" /* TestEnum.Test2 */] = '123',
_a;
};
return A;
@@ -76,4 +76,4 @@ var E;
})(E || (E = {}));
function foo1(...a) { }
foo1(1, 2, 3, E.a);
foo1(1, 2, 3, 0 /* a */, E.b);
foo1(1, 2, 3, 0 /* E1.a */, E.b);
@@ -142,4 +142,4 @@ function foo1() {
}
}
foo1(1, 2, 3, E.a);
foo1(1, 2, 3, 0 /* a */, E.b);
foo1(1, 2, 3, 0 /* E1.a */, E.b);
@@ -76,4 +76,4 @@ var E;
})(E || (E = {}));
function foo1(...a) { }
foo1(1, 2, 3, E.a);
foo1(1, 2, 3, 0 /* a */, E.b);
foo1(1, 2, 3, 0 /* E1.a */, E.b);
@@ -321,9 +321,9 @@ function onlyPlus(arg) {
function func3(value) {
if (value.type !== undefined) {
switch (value.type) {
case 1 /* bar1 */:
case 1 /* BarEnum.bar1 */:
break;
case 2 /* bar2 */:
case 2 /* BarEnum.bar2 */:
break;
default:
never(value.type);
+11 -11
View File
@@ -152,8 +152,8 @@ function f4(a, b) {
b++;
}
function f5(a, b, c) {
var z1 = g(1 /* Yes */);
var z2 = g(2 /* No */);
var z1 = g(1 /* Choice.Yes */);
var z2 = g(2 /* Choice.No */);
var z3 = g(a);
var z4 = g(b);
var z5 = g(c);
@@ -163,14 +163,14 @@ function assertNever(x) {
}
function f10(x) {
switch (x) {
case 1 /* Yes */: return "true";
case 2 /* No */: return "false";
case 1 /* Choice.Yes */: return "true";
case 2 /* Choice.No */: return "false";
}
}
function f11(x) {
switch (x) {
case 1 /* Yes */: return "true";
case 2 /* No */: return "false";
case 1 /* Choice.Yes */: return "true";
case 2 /* Choice.No */: return "false";
}
return assertNever(x);
}
@@ -183,7 +183,7 @@ function f12(x) {
}
}
function f13(x) {
if (x === 1 /* Yes */) {
if (x === 1 /* Choice.Yes */) {
x;
}
else {
@@ -192,14 +192,14 @@ function f13(x) {
}
function f20(x) {
switch (x.kind) {
case 1 /* Yes */: return x.a;
case 2 /* No */: return x.b;
case 1 /* Choice.Yes */: return x.a;
case 2 /* Choice.No */: return x.b;
}
}
function f21(x) {
switch (x.kind) {
case 1 /* Yes */: return x.a;
case 2 /* No */: return x.b;
case 1 /* Choice.Yes */: return x.a;
case 2 /* Choice.No */: return x.b;
}
return assertNever(x);
}
+11 -11
View File
@@ -152,8 +152,8 @@ function f4(a, b) {
b++;
}
function f5(a, b, c) {
var z1 = g(1 /* Yes */);
var z2 = g(2 /* No */);
var z1 = g(1 /* Choice.Yes */);
var z2 = g(2 /* Choice.No */);
var z3 = g(a);
var z4 = g(b);
var z5 = g(c);
@@ -163,14 +163,14 @@ function assertNever(x) {
}
function f10(x) {
switch (x) {
case 1 /* Yes */: return "true";
case 2 /* No */: return "false";
case 1 /* Choice.Yes */: return "true";
case 2 /* Choice.No */: return "false";
}
}
function f11(x) {
switch (x) {
case 1 /* Yes */: return "true";
case 2 /* No */: return "false";
case 1 /* Choice.Yes */: return "true";
case 2 /* Choice.No */: return "false";
}
return assertNever(x);
}
@@ -183,7 +183,7 @@ function f12(x) {
}
}
function f13(x) {
if (x === 1 /* Yes */) {
if (x === 1 /* Choice.Yes */) {
x;
}
else {
@@ -192,14 +192,14 @@ function f13(x) {
}
function f20(x) {
switch (x.kind) {
case 1 /* Yes */: return x.a;
case 2 /* No */: return x.b;
case 1 /* Choice.Yes */: return x.a;
case 2 /* Choice.No */: return x.b;
}
}
function f21(x) {
switch (x.kind) {
case 1 /* Yes */: return x.a;
case 2 /* No */: return x.b;
case 1 /* Choice.Yes */: return x.a;
case 2 /* Choice.No */: return x.b;
}
return assertNever(x);
}
+36 -36
View File
@@ -146,32 +146,32 @@ function f4(a, b, c, d) {
d = d;
}
function f5(a, b, c, d) {
a = 0 /* Unknown */;
a = 1 /* Yes */;
a = 2 /* No */;
b = 0 /* Unknown */;
b = 1 /* Yes */;
b = 2 /* No */;
c = 0 /* Unknown */;
c = 1 /* Yes */;
c = 2 /* No */;
d = 0 /* Unknown */;
d = 1 /* Yes */;
d = 2 /* No */;
a = 0 /* Choice.Unknown */;
a = 1 /* Choice.Yes */;
a = 2 /* Choice.No */;
b = 0 /* Choice.Unknown */;
b = 1 /* Choice.Yes */;
b = 2 /* Choice.No */;
c = 0 /* Choice.Unknown */;
c = 1 /* Choice.Yes */;
c = 2 /* Choice.No */;
d = 0 /* Choice.Unknown */;
d = 1 /* Choice.Yes */;
d = 2 /* Choice.No */;
}
function f6(a, b, c, d) {
a === 0 /* Unknown */;
a === 1 /* Yes */;
a === 2 /* No */;
b === 0 /* Unknown */;
b === 1 /* Yes */;
b === 2 /* No */;
c === 0 /* Unknown */;
c === 1 /* Yes */;
c === 2 /* No */;
d === 0 /* Unknown */;
d === 1 /* Yes */;
d === 2 /* No */;
a === 0 /* Choice.Unknown */;
a === 1 /* Choice.Yes */;
a === 2 /* Choice.No */;
b === 0 /* Choice.Unknown */;
b === 1 /* Choice.Yes */;
b === 2 /* Choice.No */;
c === 0 /* Choice.Unknown */;
c === 1 /* Choice.Yes */;
c === 2 /* Choice.No */;
d === 0 /* Choice.Unknown */;
d === 1 /* Choice.Yes */;
d === 2 /* Choice.No */;
}
function f7(a, b, c, d) {
a === a;
@@ -193,33 +193,33 @@ function f7(a, b, c, d) {
}
function f10(x) {
switch (x) {
case 0 /* Unknown */: return x;
case 1 /* Yes */: return x;
case 2 /* No */: return x;
case 0 /* Choice.Unknown */: return x;
case 1 /* Choice.Yes */: return x;
case 2 /* Choice.No */: return x;
}
return x;
}
function f11(x) {
switch (x) {
case 0 /* Unknown */: return x;
case 1 /* Yes */: return x;
case 2 /* No */: return x;
case 0 /* Choice.Unknown */: return x;
case 1 /* Choice.Yes */: return x;
case 2 /* Choice.No */: return x;
}
return x;
}
function f12(x) {
switch (x) {
case 0 /* Unknown */: return x;
case 1 /* Yes */: return x;
case 2 /* No */: return x;
case 0 /* Choice.Unknown */: return x;
case 1 /* Choice.Yes */: return x;
case 2 /* Choice.No */: return x;
}
return x;
}
function f13(x) {
switch (x) {
case 0 /* Unknown */: return x;
case 1 /* Yes */: return x;
case 2 /* No */: return x;
case 0 /* Choice.Unknown */: return x;
case 1 /* Choice.Yes */: return x;
case 2 /* Choice.No */: return x;
}
return x;
}
@@ -8,7 +8,7 @@ const enum ConstColor { Red, Green, Blue }
//// [enumUsedBeforeDeclaration.js]
var v = Color.Green;
var v2 = 1 /* Green */;
var v2 = 1 /* ConstColor.Green */;
var Color;
(function (Color) {
Color[Color["Red"] = 0] = "Red";
+2 -2
View File
@@ -43,10 +43,10 @@ var SyntaxKind;
"use strict";
exports.__esModule = true;
SyntaxKind.ImportClause;
"Type" /* Type */;
"Type" /* SymbolFlags.Type */;
var kind;
var flags;
//// [c.js]
"use strict";
exports.__esModule = true;
var flags = "Type" /* Type */;
var flags = "Type" /* SymbolFlags.Type */;
@@ -46,20 +46,20 @@ module m2 {
}
//// [es6ModuleConstEnumDeclaration.js]
var x = 0 /* a */;
var y = 0 /* x */;
var x = 0 /* e1.a */;
var y = 0 /* e2.x */;
export var m1;
(function (m1) {
var x1 = 0 /* a */;
var y1 = 0 /* x */;
var x2 = 0 /* a */;
var y2 = 0 /* x */;
var x1 = 0 /* e1.a */;
var y1 = 0 /* e2.x */;
var x2 = 0 /* e3.a */;
var y2 = 0 /* e4.x */;
})(m1 || (m1 = {}));
var m2;
(function (m2) {
var x1 = 0 /* a */;
var y1 = 0 /* x */;
var x2 = 0 /* a */;
var y2 = 0 /* x */;
var x3 = 0 /* a */;
var x1 = 0 /* e1.a */;
var y1 = 0 /* e2.x */;
var x2 = 0 /* e5.a */;
var y2 = 0 /* e6.x */;
var x3 = 0 /* m1.e3.a */;
})(m2 || (m2 = {}));
@@ -58,8 +58,8 @@ var e2;
e2[e2["y"] = 1] = "y";
e2[e2["z"] = 2] = "z";
})(e2 || (e2 = {}));
var x = 0 /* a */;
var y = 0 /* x */;
var x = 0 /* e1.a */;
var y = 0 /* e2.x */;
export var m1;
(function (m1) {
let e3;
@@ -74,10 +74,10 @@ export var m1;
e4[e4["y"] = 1] = "y";
e4[e4["z"] = 2] = "z";
})(e4 || (e4 = {}));
var x1 = 0 /* a */;
var y1 = 0 /* x */;
var x2 = 0 /* a */;
var y2 = 0 /* x */;
var x1 = 0 /* e1.a */;
var y1 = 0 /* e2.x */;
var x2 = 0 /* e3.a */;
var y2 = 0 /* e4.x */;
})(m1 || (m1 = {}));
var m2;
(function (m2) {
@@ -93,9 +93,9 @@ var m2;
e6[e6["y"] = 1] = "y";
e6[e6["z"] = 2] = "z";
})(e6 || (e6 = {}));
var x1 = 0 /* a */;
var y1 = 0 /* x */;
var x2 = 0 /* a */;
var y2 = 0 /* x */;
var x3 = 0 /* a */;
var x1 = 0 /* e1.a */;
var y1 = 0 /* e2.x */;
var x2 = 0 /* e5.a */;
var y2 = 0 /* e6.x */;
var x3 = 0 /* m1.e3.a */;
})(m2 || (m2 = {}));
@@ -77,9 +77,9 @@ var MsPortalFx;
var SomeUsagesOfTheseConsts = /** @class */ (function () {
function SomeUsagesOfTheseConsts() {
// these do get replaced by the const value
var value1 = 1 /* Cancel */;
var value1 = 1 /* ReExportedEnum.Cancel */;
console.log(value1);
var value2 = 2 /* OKCancel */;
var value2 = 2 /* DialogButtons.OKCancel */;
console.log(value2);
}
return SomeUsagesOfTheseConsts;
@@ -40,7 +40,7 @@ var SomeOther;
var Foo = /** @class */ (function () {
function Foo() {
Internal.getThing();
0 /* A */ ? "foo" : "bar";
0 /* Internal.WhichThing.A */ ? "foo" : "bar";
}
return Foo;
}());
@@ -109,9 +109,9 @@ require("./a"); // noUnusedLocals error only
"use strict";
exports.__esModule = true;
require("./a");
0 /* One */;
var c = 1 /* Two */;
var d = 1 /* Two */;
0 /* C.One */;
var c = 1 /* C.Two */;
var d = 1 /* C.Two */;
console.log(c, d);
//// [g.js]
"use strict";
@@ -141,4 +141,4 @@ exports.__esModule = true;
//// [l.js]
"use strict";
exports.__esModule = true;
0 /* One */;
0 /* K.One */;
@@ -125,8 +125,8 @@ function f3(a, b) {
var y = !b;
}
function f5(a, b, c) {
var z1 = g("yes" /* Yes */);
var z2 = g("no" /* No */);
var z1 = g("yes" /* Choice.Yes */);
var z2 = g("no" /* Choice.No */);
var z3 = g(a);
var z4 = g(b);
var z5 = g(c);
@@ -136,14 +136,14 @@ function assertNever(x) {
}
function f10(x) {
switch (x) {
case "yes" /* Yes */: return "true";
case "no" /* No */: return "false";
case "yes" /* Choice.Yes */: return "true";
case "no" /* Choice.No */: return "false";
}
}
function f11(x) {
switch (x) {
case "yes" /* Yes */: return "true";
case "no" /* No */: return "false";
case "yes" /* Choice.Yes */: return "true";
case "no" /* Choice.No */: return "false";
}
return assertNever(x);
}
@@ -156,7 +156,7 @@ function f12(x) {
}
}
function f13(x) {
if (x === "yes" /* Yes */) {
if (x === "yes" /* Choice.Yes */) {
x;
}
else {
@@ -165,14 +165,14 @@ function f13(x) {
}
function f20(x) {
switch (x.kind) {
case "yes" /* Yes */: return x.a;
case "no" /* No */: return x.b;
case "yes" /* Choice.Yes */: return x.a;
case "no" /* Choice.No */: return x.b;
}
}
function f21(x) {
switch (x.kind) {
case "yes" /* Yes */: return x.a;
case "no" /* No */: return x.b;
case "yes" /* Choice.Yes */: return x.a;
case "no" /* Choice.No */: return x.b;
}
return assertNever(x);
}
@@ -125,8 +125,8 @@ function f3(a, b) {
var y = !b;
}
function f5(a, b, c) {
var z1 = g("yes" /* Yes */);
var z2 = g("no" /* No */);
var z1 = g("yes" /* Choice.Yes */);
var z2 = g("no" /* Choice.No */);
var z3 = g(a);
var z4 = g(b);
var z5 = g(c);
@@ -136,14 +136,14 @@ function assertNever(x) {
}
function f10(x) {
switch (x) {
case "yes" /* Yes */: return "true";
case "no" /* No */: return "false";
case "yes" /* Choice.Yes */: return "true";
case "no" /* Choice.No */: return "false";
}
}
function f11(x) {
switch (x) {
case "yes" /* Yes */: return "true";
case "no" /* No */: return "false";
case "yes" /* Choice.Yes */: return "true";
case "no" /* Choice.No */: return "false";
}
return assertNever(x);
}
@@ -156,7 +156,7 @@ function f12(x) {
}
}
function f13(x) {
if (x === "yes" /* Yes */) {
if (x === "yes" /* Choice.Yes */) {
x;
}
else {
@@ -165,14 +165,14 @@ function f13(x) {
}
function f20(x) {
switch (x.kind) {
case "yes" /* Yes */: return x.a;
case "no" /* No */: return x.b;
case "yes" /* Choice.Yes */: return x.a;
case "no" /* Choice.No */: return x.b;
}
}
function f21(x) {
switch (x.kind) {
case "yes" /* Yes */: return x.a;
case "no" /* No */: return x.b;
case "yes" /* Choice.Yes */: return x.a;
case "no" /* Choice.No */: return x.b;
}
return assertNever(x);
}
@@ -146,32 +146,32 @@ function f4(a, b, c, d) {
d = d;
}
function f5(a, b, c, d) {
a = "" /* Unknown */;
a = "yes" /* Yes */;
a = "no" /* No */;
b = "" /* Unknown */;
b = "yes" /* Yes */;
b = "no" /* No */;
c = "" /* Unknown */;
c = "yes" /* Yes */;
c = "no" /* No */;
d = "" /* Unknown */;
d = "yes" /* Yes */;
d = "no" /* No */;
a = "" /* Choice.Unknown */;
a = "yes" /* Choice.Yes */;
a = "no" /* Choice.No */;
b = "" /* Choice.Unknown */;
b = "yes" /* Choice.Yes */;
b = "no" /* Choice.No */;
c = "" /* Choice.Unknown */;
c = "yes" /* Choice.Yes */;
c = "no" /* Choice.No */;
d = "" /* Choice.Unknown */;
d = "yes" /* Choice.Yes */;
d = "no" /* Choice.No */;
}
function f6(a, b, c, d) {
a === "" /* Unknown */;
a === "yes" /* Yes */;
a === "no" /* No */;
b === "" /* Unknown */;
b === "yes" /* Yes */;
b === "no" /* No */;
c === "" /* Unknown */;
c === "yes" /* Yes */;
c === "no" /* No */;
d === "" /* Unknown */;
d === "yes" /* Yes */;
d === "no" /* No */;
a === "" /* Choice.Unknown */;
a === "yes" /* Choice.Yes */;
a === "no" /* Choice.No */;
b === "" /* Choice.Unknown */;
b === "yes" /* Choice.Yes */;
b === "no" /* Choice.No */;
c === "" /* Choice.Unknown */;
c === "yes" /* Choice.Yes */;
c === "no" /* Choice.No */;
d === "" /* Choice.Unknown */;
d === "yes" /* Choice.Yes */;
d === "no" /* Choice.No */;
}
function f7(a, b, c, d) {
a === a;
@@ -193,33 +193,33 @@ function f7(a, b, c, d) {
}
function f10(x) {
switch (x) {
case "" /* Unknown */: return x;
case "yes" /* Yes */: return x;
case "no" /* No */: return x;
case "" /* Choice.Unknown */: return x;
case "yes" /* Choice.Yes */: return x;
case "no" /* Choice.No */: return x;
}
return x;
}
function f11(x) {
switch (x) {
case "" /* Unknown */: return x;
case "yes" /* Yes */: return x;
case "no" /* No */: return x;
case "" /* Choice.Unknown */: return x;
case "yes" /* Choice.Yes */: return x;
case "no" /* Choice.No */: return x;
}
return x;
}
function f12(x) {
switch (x) {
case "" /* Unknown */: return x;
case "yes" /* Yes */: return x;
case "no" /* No */: return x;
case "" /* Choice.Unknown */: return x;
case "yes" /* Choice.Yes */: return x;
case "no" /* Choice.No */: return x;
}
return x;
}
function f13(x) {
switch (x) {
case "" /* Unknown */: return x;
case "yes" /* Yes */: return x;
case "no" /* No */: return x;
case "" /* Choice.Unknown */: return x;
case "yes" /* Choice.Yes */: return x;
case "no" /* Choice.No */: return x;
}
return x;
}
@@ -16,8 +16,8 @@ System.register([], function (exports_1, context_1) {
"use strict";
var __moduleName = context_1 && context_1.id;
function foo() {
use(0 /* X */);
use(0 /* X */);
use(0 /* TopLevelConstEnum.X */);
use(0 /* M.NonTopLevelConstEnum.X */);
}
exports_1("foo", foo);
return {
@@ -81,7 +81,7 @@ exports.__esModule = true;
//// [/user/someone/projects/myproject/file3.js]
"use strict";
exports.__esModule = true;
var v = 1 /* V */;
var v = 1 /* E2.V */;
@@ -134,7 +134,7 @@ exitCode:: ExitStatus.undefined
//// [/user/someone/projects/myproject/file3.js]
"use strict";
exports.__esModule = true;
var v = 1 /* V */;
var v = 1 /* E2.V */;
function foo2() { return 2; }
@@ -1,7 +1,7 @@
/// <reference path='fourslash.ts'/>
// @Filename: a.ts
////const enum TestEnum {
////const enum TestEnum {
//// Foo, Bar
////}
////var testFirstFile = TestEnum.Bar;
@@ -14,5 +14,5 @@
goTo.marker("1");
verify.verifyGetEmitOutputForCurrentFile(
"/// <reference path=\"a.ts\" />\r\n\
var testInOtherFile = 1 /* Bar */;\r\n"
var testInOtherFile = 1 /* TestEnum.Bar */;\r\n"
)