Skip to content

Commit

Permalink
chore: update test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
magic-akari committed Dec 8, 2023
1 parent b311757 commit 55ff8ad
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 17 deletions.
13 changes: 12 additions & 1 deletion crates/swc/tests/fixture/issues-8xxx/8398/input/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
(obj?.a).b
(obj?.a).b;
(obj?.a)();
(obj?.a)[0];
(obj?.a)`hello`;

(obj.a?.()).a;
(obj.a?.())();
(obj.a?.())[0];
(obj.a?.())`hello`;

(((a?.b)));
(((a?.())));
2 changes: 1 addition & 1 deletion crates/swc/tests/fixture/issues-8xxx/8398/output/index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
(obj?.a).b;
(obj?.a).b,(obj?.a)(),(obj?.a)[0],(obj?.a)`hello`,(obj.a?.()).a,(obj.a?.())(),(obj.a?.())[0],(obj.a?.())`hello`,a?.b,a?.();
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var needsExemplar = function() {
var _ = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : x;
return void 0;
};
var expected = /** @type {{name: string, readonly middleInit: string, readonly lastName: string, zip: number, readonly houseNumber: number, zipStr: string}} */ /** @type {*} */ null;
var expected = /** @type {*} */ null;
/**
*
* @param {typeof returnExemplar} a
Expand Down
16 changes: 8 additions & 8 deletions crates/swc/tests/tsc-references/deleteChain.1.normal.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
//// [deleteChain.ts]
var _o3_b, _o3_b1, _o4_b_c_d, _o4_b, _this, _o4_b1, _o4_b_c_d1, _o4_b2, _o5_b_c_d, _o5_b, _o5_b_c_d1, _o5_b1, _o6_b_c_d, _o6_b, _o6_b_c_d1, _o6_b1;
var _o3_b, _o3_b1, _o4_b_c_d, _o4_b, _o4_b_c_d1, _o4_b1, _o4_b_c_d2, _o4_b2, _o5_b_c_d, _o5_b, _o5_b_c_d1, _o5_b1, _o6_b_c_d, _o6_b, _o6_b_c_d1, _o6_b1;
o1 === null || o1 === void 0 ? true : delete o1.b;
delete (o1 === null || o1 === void 0 ? void 0 : o1.b);
o1 === null || o1 === void 0 ? true : delete o1.b;
o2 === null || o2 === void 0 ? true : delete o2.b.c;
o2 === null || o2 === void 0 ? true : delete o2.b.c;
delete (o2 === null || o2 === void 0 ? void 0 : o2.b.c);
(_o3_b = o3.b) === null || _o3_b === void 0 ? true : delete _o3_b.c;
delete ((_o3_b1 = o3.b) === null || _o3_b1 === void 0 ? void 0 : _o3_b1.c);
(_o3_b1 = o3.b) === null || _o3_b1 === void 0 ? true : delete _o3_b1.c;
(_o4_b = o4.b) === null || _o4_b === void 0 ? true : (_o4_b_c_d = _o4_b.c.d) === null || _o4_b_c_d === void 0 ? true : delete _o4_b_c_d.e;
(_this = (_o4_b1 = o4.b) === null || _o4_b1 === void 0 ? void 0 : _o4_b1.c.d) === null || _this === void 0 ? true : delete _this.e;
delete ((_o4_b2 = o4.b) === null || _o4_b2 === void 0 ? void 0 : (_o4_b_c_d1 = _o4_b2.c.d) === null || _o4_b_c_d1 === void 0 ? void 0 : _o4_b_c_d1.e);
(_o4_b1 = o4.b) === null || _o4_b1 === void 0 ? true : (_o4_b_c_d1 = _o4_b1.c.d) === null || _o4_b_c_d1 === void 0 ? true : delete _o4_b_c_d1.e;
(_o4_b2 = o4.b) === null || _o4_b2 === void 0 ? true : (_o4_b_c_d2 = _o4_b2.c.d) === null || _o4_b_c_d2 === void 0 ? true : delete _o4_b_c_d2.e;
(_o5_b = o5.b) === null || _o5_b === void 0 ? true : (_o5_b_c_d = _o5_b.call(o5).c.d) === null || _o5_b_c_d === void 0 ? true : delete _o5_b_c_d.e;
delete ((_o5_b1 = o5.b) === null || _o5_b1 === void 0 ? void 0 : (_o5_b_c_d1 = _o5_b1.call(o5).c.d) === null || _o5_b_c_d1 === void 0 ? void 0 : _o5_b_c_d1.e);
(_o5_b1 = o5.b) === null || _o5_b1 === void 0 ? true : (_o5_b_c_d1 = _o5_b1.call(o5).c.d) === null || _o5_b_c_d1 === void 0 ? true : delete _o5_b_c_d1.e;
(_o6_b = o6.b) === null || _o6_b === void 0 ? true : (_o6_b_c_d = _o6_b["c"].d) === null || _o6_b_c_d === void 0 ? true : delete _o6_b_c_d["e"];
delete ((_o6_b1 = o6.b) === null || _o6_b1 === void 0 ? void 0 : (_o6_b_c_d1 = _o6_b1["c"].d) === null || _o6_b_c_d1 === void 0 ? void 0 : _o6_b_c_d1["e"]);
(_o6_b1 = o6.b) === null || _o6_b1 === void 0 ? true : (_o6_b_c_d1 = _o6_b1["c"].d) === null || _o6_b_c_d1 === void 0 ? true : delete _o6_b_c_d1["e"];
4 changes: 2 additions & 2 deletions crates/swc/tests/tsc-references/deleteChain.2.minified.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//// [index.js]
/**
* @typedef {import("./externs")} Foo
*/ let a = /** @type {Foo} */ /** @type {*} */ undefined;
*/ let a = /** @type {*} */ undefined;
a = new Foo({
doer: Foo.Bar
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const foo = new Foo();
(_foo_m1 = foo.m) === null || _foo_m1 === void 0 ? void 0 : _foo_m1.call(foo);
(_foo_m2 = foo.m) === null || _foo_m2 === void 0 ? void 0 : _foo_m2.call(foo);
(_foo_m3 = foo.m) === null || _foo_m3 === void 0 ? void 0 : _foo_m3.call(foo);
// https://github.com/microsoft/TypeScript/issues/50148
(foo === null || foo === void 0 ? void 0 : foo.m).length;
(// https://github.com/microsoft/TypeScript/issues/50148
foo === null || foo === void 0 ? void 0 : foo.m).length;
(foo === null || foo === void 0 ? void 0 : foo.m).length;
(foo === null || foo === void 0 ? void 0 : foo["m"]).length;
(foo === null || foo === void 0 ? void 0 : foo["m"]).length;
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
const foo = new class {
m() {}
}();
foo.m?.(), foo.m?.(), foo.m?.(), foo.m?.(), foo?.m.length, foo?.m.length, foo?.m.length, foo?.m.length;
foo.m?.(), foo.m?.(), foo.m?.(), foo.m?.(), (foo?.m).length, (foo?.m).length, (foo?.m).length, (foo?.m).length;

0 comments on commit 55ff8ad

Please sign in to comment.