Skip to content

Commit

Permalink
test(es): Update conformance test suite from tsc (#8834)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Apr 11, 2024
1 parent b103184 commit ea5d9cc
Show file tree
Hide file tree
Showing 278 changed files with 22,323 additions and 10,197 deletions.
Expand Up @@ -9,8 +9,8 @@ try {
_iteratorError = err;
} finally{
try {
if (!_iteratorNormalCompletion && _iterator["return"] != null) {
_iterator["return"]();
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally{
if (_didIteratorError) {
Expand Down
Expand Up @@ -10,8 +10,8 @@ try {
_iteratorError = err;
} finally{
try {
if (!_iteratorNormalCompletion && _iterator["return"] != null) {
_iterator["return"]();
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally{
if (_didIteratorError) {
Expand Down
Expand Up @@ -10,8 +10,8 @@ try {
_iteratorError = err;
} finally{
try {
if (!_iteratorNormalCompletion && _iterator["return"] != null) {
_iterator["return"]();
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally{
if (_didIteratorError) {
Expand Down
2 changes: 2 additions & 0 deletions crates/swc/tests/tsc-references/ambientAccessors.1.normal.js
@@ -0,0 +1,2 @@
//// [ambientAccessors.ts]
// ok to use accessors in ambient class in ES3
@@ -0,0 +1 @@
//// [ambientAccessors.ts]
@@ -0,0 +1,34 @@
//// [controlFlowComputedPropertyNames.ts]
function f1(obj, key) {
if (typeof obj[key] === "string") {
obj[key].toUpperCase();
}
}
function f2(obj, key) {
if (obj[key] !== undefined) {
obj[key].toUpperCase();
}
var key2 = key + key;
if (obj[key2] !== undefined) {
obj[key2].toUpperCase();
}
var key3 = key + key;
if (obj[key3] !== undefined) {
obj[key3].toUpperCase();
}
}
function f3(obj, key) {
if (obj[key] !== undefined) {
if (typeof obj[key] === "string") {
obj[key].toUpperCase();
}
if (typeof obj[key] === "number") {
obj[key].toFixed();
}
}
}
function f4(obj, key) {
if (obj[key]) {
obj[key].toUpperCase();
}
}
@@ -0,0 +1 @@
//// [controlFlowComputedPropertyNames.ts]
Expand Up @@ -14,6 +14,6 @@ var M;
return C;
}();
_ts_decorate([
_this.decorator
this.decorator
], C.prototype, "method", null);
})(M || (M = {}));
@@ -1,13 +1,16 @@
//// [decoratorOnClassMethod11.ts]
var M, C;
var M;
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
M || (M = {}), C = function() {
function C() {
_class_call_check(this, C);
}
var _proto = C.prototype;
return _proto.decorator = function(target, key) {}, _proto.method = function() {}, C;
}(), _ts_decorate([
_this.decorator
], C.prototype, "method", null);
!function(M) {
var C = function() {
function C() {
_class_call_check(this, C);
}
var _proto = C.prototype;
return _proto.decorator = function(target, key) {}, _proto.method = function() {}, C;
}();
_ts_decorate([
this.decorator
], C.prototype, "method", null);
}(M || (M = {}));
@@ -1,13 +1,32 @@
//// [decoratorOnClassMethod12.ts]
//!
//! x Expected ident
//! ,-[3:1]
//! 3 | decorator(target: Object, key: string): void { }
//! 4 | }
//! 5 | class C extends S {
//! 6 | @super.decorator
//! : ^^^^^
//! 7 | method() { }
//! 8 | }
//! 9 | }
//! `----
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
import { _ as _inherits } from "@swc/helpers/_/_inherits";
import { _ as _create_super } from "@swc/helpers/_/_create_super";
import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
var M;
(function(M) {
var S = /*#__PURE__*/ function() {
"use strict";
function S() {
_class_call_check(this, S);
}
var _proto = S.prototype;
_proto.decorator = function decorator(target, key) {};
return S;
}();
var C = /*#__PURE__*/ function(S) {
"use strict";
_inherits(C, S);
var _super = _create_super(C);
function C() {
_class_call_check(this, C);
return _super.apply(this, arguments);
}
var _proto = C.prototype;
_proto.method = function method() {};
return C;
}(S);
_ts_decorate([
super.decorator
], C.prototype, "method", null);
})(M || (M = {}));
@@ -1,13 +1,21 @@
//// [decoratorOnClassMethod12.ts]
//!
//! x Expected ident
//! ,-[3:1]
//! 3 | decorator(target: Object, key: string): void { }
//! 4 | }
//! 5 | class C extends S {
//! 6 | @super.decorator
//! : ^^^^^
//! 7 | method() { }
//! 8 | }
//! 9 | }
//! `----
var M, C;
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
import { _ as _inherits } from "@swc/helpers/_/_inherits";
import { _ as _create_super } from "@swc/helpers/_/_create_super";
import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
M || (M = {}), C = function(S) {
_inherits(C, S);
var _super = _create_super(C);
function C() {
return _class_call_check(this, C), _super.apply(this, arguments);
}
return C.prototype.method = function() {}, C;
}(function() {
function S() {
_class_call_check(this, S);
}
return S.prototype.decorator = function(target, key) {}, S;
}()), _ts_decorate([
super.decorator
], C.prototype, "method", null);
5 changes: 5 additions & 0 deletions crates/swc/tests/tsc-references/errorIsolation.1.normal.js
@@ -0,0 +1,5 @@
//// [errorIsolation.js]
var async = {
doSomething: function(_) {}
};
async.doSomething(/***/ function() {});
4 changes: 4 additions & 0 deletions crates/swc/tests/tsc-references/errorIsolation.2.minified.js
@@ -0,0 +1,4 @@
//// [errorIsolation.js]
({
doSomething: function(_) {}
}).doSomething(function() {});
2 changes: 2 additions & 0 deletions crates/swc/tests/tsc-references/es2018IntlAPIs.1.normal.js
Expand Up @@ -10,3 +10,5 @@ const options = {
localeMatcher: 'lookup'
};
console.log(Intl.PluralRules.supportedLocalesOf(locales, options).join(', '));
const [part] = new Intl.NumberFormat().formatToParts();
console.log(part.type, part.value);
2 changes: 2 additions & 0 deletions crates/swc/tests/tsc-references/es2018IntlAPIs.2.minified.js
Expand Up @@ -6,3 +6,5 @@ console.log(Intl.PluralRules.supportedLocalesOf([
], {
localeMatcher: 'lookup'
}).join(', '));
const [part] = new Intl.NumberFormat().formatToParts();
console.log(part.type, part.value);
@@ -0,0 +1,12 @@
//// [esDecorators-decoratorExpression.1.ts]
//!
//! x Expression expected
//! ,-[1:1]
//! 1 |
//! 2 | declare let x: any;
//! 3 |
//! 4 | { @x().y class C {} }
//! : ^
//! 5 |
//! 6 | { @new x class C {} }
//! `----
@@ -0,0 +1,12 @@
//// [esDecorators-decoratorExpression.1.ts]
//!
//! x Expression expected
//! ,-[1:1]
//! 1 |
//! 2 | declare let x: any;
//! 3 |
//! 4 | { @x().y class C {} }
//! : ^
//! 5 |
//! 6 | { @new x class C {} }
//! `----
@@ -0,0 +1,12 @@
//// [esDecorators-decoratorExpression.2.ts]
//!
//! x Expression expected
//! ,-[3:1]
//! 3 | declare let g: <T>(...args: any) => any;
//! 4 | declare let h: () => <T>(...args: any) => any;
//! 5 |
//! 6 | { @x! class C {} }
//! : ^
//! 7 |
//! 8 | { @x.y! class C {} }
//! `----
@@ -0,0 +1,12 @@
//// [esDecorators-decoratorExpression.2.ts]
//!
//! x Expression expected
//! ,-[3:1]
//! 3 | declare let g: <T>(...args: any) => any;
//! 4 | declare let h: () => <T>(...args: any) => any;
//! 5 |
//! 6 | { @x! class C {} }
//! : ^
//! 7 |
//! 8 | { @x.y! class C {} }
//! `----
Expand Up @@ -13,8 +13,8 @@ Object.defineProperty(exports, "default", {
});
var R;
var _default = R = {
__esmodule: true,
__proto__: {}
"__esmodule": true,
"__proto__": {}
};
//// [m2.ts]
"use strict";
Expand Down
Expand Up @@ -13,9 +13,9 @@ Object.defineProperty(exports, "default", {
});
var R;
var _default = R = {
___: 30,
___hello: 21,
_hi: 40
"___": 30,
"___hello": 21,
"_hi": 40
};
//// [m2.ts]
"use strict";
Expand Down
9 changes: 9 additions & 0 deletions crates/swc/tests/tsc-references/importTag1.1.normal.js
@@ -0,0 +1,9 @@
//// [importTag1.ts]
//// [/types.ts]
export { };
//// [/foo.js]
/**
* @import { Foo } from "./types"
*/ /**
* @param { Foo } foo
*/ function f(foo) {}
4 changes: 4 additions & 0 deletions crates/swc/tests/tsc-references/importTag1.2.minified.js
@@ -0,0 +1,4 @@
//// [importTag1.ts]
//// [/types.ts]
export { };
//// [/foo.js]
5 changes: 5 additions & 0 deletions crates/swc/tests/tsc-references/importTag10.1.normal.js
@@ -0,0 +1,5 @@
//// [importTag10.ts]
//// [/foo.js]
/**
* @import
*/
2 changes: 2 additions & 0 deletions crates/swc/tests/tsc-references/importTag10.2.minified.js
@@ -0,0 +1,2 @@
//// [importTag10.ts]
//// [/foo.js]
5 changes: 5 additions & 0 deletions crates/swc/tests/tsc-references/importTag11.1.normal.js
@@ -0,0 +1,5 @@
//// [importTag11.ts]
//// [/foo.js]
/**
* @import foo
*/
2 changes: 2 additions & 0 deletions crates/swc/tests/tsc-references/importTag11.2.minified.js
@@ -0,0 +1,2 @@
//// [importTag11.ts]
//// [/foo.js]
5 changes: 5 additions & 0 deletions crates/swc/tests/tsc-references/importTag12.1.normal.js
@@ -0,0 +1,5 @@
//// [importTag12.ts]
//// [/foo.js]
/**
* @import foo from
*/
2 changes: 2 additions & 0 deletions crates/swc/tests/tsc-references/importTag12.2.minified.js
@@ -0,0 +1,2 @@
//// [importTag12.ts]
//// [/foo.js]
5 changes: 5 additions & 0 deletions crates/swc/tests/tsc-references/importTag13.1.normal.js
@@ -0,0 +1,5 @@
//// [importTag13.ts]
//// [/types.ts]
export { };
//// [/foo.js]
/** @import x = require("types") */
4 changes: 4 additions & 0 deletions crates/swc/tests/tsc-references/importTag13.2.minified.js
@@ -0,0 +1,4 @@
//// [importTag13.ts]
//// [/types.ts]
export { };
//// [/foo.js]
3 changes: 3 additions & 0 deletions crates/swc/tests/tsc-references/importTag14.1.normal.js
@@ -0,0 +1,3 @@
//// [importTag14.ts]
//// [/foo.js]
/** @import * as f from "./foo" with */
2 changes: 2 additions & 0 deletions crates/swc/tests/tsc-references/importTag14.2.minified.js
@@ -0,0 +1,2 @@
//// [importTag14.ts]
//// [/foo.js]
5 changes: 5 additions & 0 deletions crates/swc/tests/tsc-references/importTag15.1.normal.js
@@ -0,0 +1,5 @@
//// [importTag15.ts]
//// [0.ts]
export { };
//// [1.js]
/** @import { I } from './0' with { type: "json" } */ /** @import * as foo from './0' with { type: "json" } */ /** @param {I} a */ function f(a) {}
4 changes: 4 additions & 0 deletions crates/swc/tests/tsc-references/importTag15.2.minified.js
@@ -0,0 +1,4 @@
//// [importTag15.ts]
//// [0.ts]
export { };
//// [1.js]
8 changes: 8 additions & 0 deletions crates/swc/tests/tsc-references/importTag16.1.normal.js
@@ -0,0 +1,8 @@
//// [importTag16.ts]
//// [a.ts]
export { };
//// [b.js]
/** @import Foo, { I } from "./a" */ /**
* @param {Foo} a
* @param {I} b
*/ export function foo(a, b) {}
5 changes: 5 additions & 0 deletions crates/swc/tests/tsc-references/importTag16.2.minified.js
@@ -0,0 +1,5 @@
//// [importTag16.ts]
//// [a.ts]
export { };
//// [b.js]
export function foo(a, b) {}
9 changes: 9 additions & 0 deletions crates/swc/tests/tsc-references/importTag2.1.normal.js
@@ -0,0 +1,9 @@
//// [importTag2.ts]
//// [/types.ts]
export { };
//// [/foo.js]
/**
* @import * as types from "./types"
*/ /**
* @param { types.Foo } foo
*/ export function f(foo) {}
5 changes: 5 additions & 0 deletions crates/swc/tests/tsc-references/importTag2.2.minified.js
@@ -0,0 +1,5 @@
//// [importTag2.ts]
//// [/types.ts]
export { };
//// [/foo.js]
export function f(foo) {}
9 changes: 9 additions & 0 deletions crates/swc/tests/tsc-references/importTag3.1.normal.js
@@ -0,0 +1,9 @@
//// [importTag3.ts]
//// [/types.ts]
export { };
//// [/foo.js]
/**
* @import Foo from "./types"
*/ /**
* @param { Foo } foo
*/ export function f(foo) {}

0 comments on commit ea5d9cc

Please sign in to comment.