test(es): Update conformance test suite from tsc (#8834)

This commit is contained in:
Donny/강동윤 2024-04-11 16:22:56 +09:00 committed by GitHub
parent b103184832
commit ea5d9cc524
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
278 changed files with 22360 additions and 10234 deletions

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -0,0 +1,2 @@
//// [ambientAccessors.ts]
// ok to use accessors in ambient class in ES3

View File

@ -0,0 +1 @@
//// [ambientAccessors.ts]

View File

@ -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();
}
}

View File

@ -0,0 +1 @@
//// [controlFlowComputedPropertyNames.ts]

View File

@ -14,6 +14,6 @@ var M;
return C;
}();
_ts_decorate([
_this.decorator
this.decorator
], C.prototype, "method", null);
})(M || (M = {}));

View File

@ -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 = {}));

View File

@ -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 = {}));

View File

@ -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);

View File

@ -0,0 +1,5 @@
//// [errorIsolation.js]
var async = {
doSomething: function(_) {}
};
async.doSomething(/***/ function() {});

View File

@ -0,0 +1,4 @@
//// [errorIsolation.js]
({
doSomething: function(_) {}
}).doSomething(function() {});

View File

@ -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);

View File

@ -6,3 +6,5 @@ console.log(Intl.PluralRules.supportedLocalesOf([
], {
localeMatcher: 'lookup'
}).join(', '));
const [part] = new Intl.NumberFormat().formatToParts();
console.log(part.type, part.value);

View File

@ -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 {} }
//! `----

View File

@ -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 {} }
//! `----

View File

@ -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 {} }
//! `----

View File

@ -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 {} }
//! `----

View File

@ -13,8 +13,8 @@ Object.defineProperty(exports, "default", {
});
var R;
var _default = R = {
__esmodule: true,
__proto__: {}
"__esmodule": true,
"__proto__": {}
};
//// [m2.ts]
"use strict";

View File

@ -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";

View File

@ -0,0 +1,9 @@
//// [importTag1.ts]
//// [/types.ts]
export { };
//// [/foo.js]
/**
* @import { Foo } from "./types"
*/ /**
* @param { Foo } foo
*/ function f(foo) {}

View File

@ -0,0 +1,4 @@
//// [importTag1.ts]
//// [/types.ts]
export { };
//// [/foo.js]

View File

@ -0,0 +1,5 @@
//// [importTag10.ts]
//// [/foo.js]
/**
* @import
*/

View File

@ -0,0 +1,2 @@
//// [importTag10.ts]
//// [/foo.js]

View File

@ -0,0 +1,5 @@
//// [importTag11.ts]
//// [/foo.js]
/**
* @import foo
*/

View File

@ -0,0 +1,2 @@
//// [importTag11.ts]
//// [/foo.js]

View File

@ -0,0 +1,5 @@
//// [importTag12.ts]
//// [/foo.js]
/**
* @import foo from
*/

View File

@ -0,0 +1,2 @@
//// [importTag12.ts]
//// [/foo.js]

View File

@ -0,0 +1,5 @@
//// [importTag13.ts]
//// [/types.ts]
export { };
//// [/foo.js]
/** @import x = require("types") */

View File

@ -0,0 +1,4 @@
//// [importTag13.ts]
//// [/types.ts]
export { };
//// [/foo.js]

View File

@ -0,0 +1,3 @@
//// [importTag14.ts]
//// [/foo.js]
/** @import * as f from "./foo" with */

View File

@ -0,0 +1,2 @@
//// [importTag14.ts]
//// [/foo.js]

View File

@ -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) {}

View File

@ -0,0 +1,4 @@
//// [importTag15.ts]
//// [0.ts]
export { };
//// [1.js]

View File

@ -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) {}

View File

@ -0,0 +1,5 @@
//// [importTag16.ts]
//// [a.ts]
export { };
//// [b.js]
export function foo(a, b) {}

View File

@ -0,0 +1,9 @@
//// [importTag2.ts]
//// [/types.ts]
export { };
//// [/foo.js]
/**
* @import * as types from "./types"
*/ /**
* @param { types.Foo } foo
*/ export function f(foo) {}

View File

@ -0,0 +1,5 @@
//// [importTag2.ts]
//// [/types.ts]
export { };
//// [/foo.js]
export function f(foo) {}

View File

@ -0,0 +1,9 @@
//// [importTag3.ts]
//// [/types.ts]
export { };
//// [/foo.js]
/**
* @import Foo from "./types"
*/ /**
* @param { Foo } foo
*/ export function f(foo) {}

View File

@ -0,0 +1,5 @@
//// [importTag3.ts]
//// [/types.ts]
export { };
//// [/foo.js]
export function f(foo) {}

View File

@ -0,0 +1,11 @@
//// [importTag4.ts]
//// [/types.ts]
export { };
//// [/foo.js]
/**
* @import { Foo } from "./types"
*/ /**
* @import { Foo } from "./types"
*/ /**
* @param { Foo } foo
*/ function f(foo) {}

View File

@ -0,0 +1,4 @@
//// [importTag4.ts]
//// [/types.ts]
export { };
//// [/foo.js]

View File

@ -0,0 +1,9 @@
//// [importTag5.ts]
//// [/types.ts]
export { };
//// [/foo.js]
/**
* @import { Foo } from "./types"
*/ /**
* @param { Foo } foo
*/ function f(foo) {}

View File

@ -0,0 +1,4 @@
//// [importTag5.ts]
//// [/types.ts]
export { };
//// [/foo.js]

View File

@ -0,0 +1,13 @@
//// [importTag6.ts]
//// [/types.ts]
export { };
//// [/foo.js]
/**
* @import {
* A,
* B,
* } from "./types"
*/ /**
* @param { A } a
* @param { B } b
*/ function f(a, b) {}

View File

@ -0,0 +1,4 @@
//// [importTag6.ts]
//// [/types.ts]
export { };
//// [/foo.js]

View File

@ -0,0 +1,12 @@
//// [importTag7.ts]
//// [/types.ts]
export { };
//// [/foo.js]
/**
* @import {
* A,
* B } from "./types"
*/ /**
* @param { A } a
* @param { B } b
*/ function f(a, b) {}

View File

@ -0,0 +1,4 @@
//// [importTag7.ts]
//// [/types.ts]
export { };
//// [/foo.js]

View File

@ -0,0 +1,12 @@
//// [importTag8.ts]
//// [/types.ts]
export { };
//// [/foo.js]
/**
* @import
* { A, B }
* from "./types"
*/ /**
* @param { A } a
* @param { B } b
*/ function f(a, b) {}

View File

@ -0,0 +1,4 @@
//// [importTag8.ts]
//// [/types.ts]
export { };
//// [/foo.js]

View File

@ -0,0 +1,12 @@
//// [importTag9.ts]
//// [/types.ts]
export { };
//// [/foo.js]
/**
* @import
* * as types
* from "./types"
*/ /**
* @param { types.A } a
* @param { types.B } b
*/ function f(a, b) {}

View File

@ -0,0 +1,4 @@
//// [importTag9.ts]
//// [/types.ts]
export { };
//// [/foo.js]

View File

@ -63,3 +63,5 @@ if (obj instanceof A) {
if (obj instanceof B) {
obj; // B
}
lhs0 instanceof rhs14 && lhs0;
lhs0 instanceof rhs15 && lhs0;

View File

@ -1,2 +1,2 @@
//// [instanceofOperatorWithRHSHasSymbolHasInstance.ts]
lhs0 instanceof rhs0 && lhs0, lhs0 instanceof rhs1 && lhs0, lhs0 instanceof rhs2 && lhs0, lhs0 instanceof rhs3 && lhs0, lhs0 instanceof rhs4 && lhs0, lhs0 instanceof rhs5 && lhs0, lhs0 instanceof rhs6 && lhs0, lhs0 instanceof Rhs7 && lhs0, lhs0 instanceof Rhs8 && lhs0, lhs0 instanceof Rhs9 && lhs0, lhs0 instanceof Rhs10 && lhs0, lhs0 instanceof Rhs11 && lhs0, lhs0 instanceof Rhs12 && lhs0, lhs0 instanceof Rhs13 && lhs0, lhs1 instanceof rhs0 && lhs1, lhs1 instanceof rhs1 && lhs1, lhs1 instanceof rhs2 && lhs1, lhs1 instanceof Rhs7 && lhs1, lhs1 instanceof Rhs8 && lhs1, lhs1 instanceof Rhs9 && lhs1, lhs2 instanceof rhs0 && lhs2, lhs2 instanceof rhs1 && lhs2, lhs2 instanceof rhs2 && lhs2, lhs2 instanceof rhs3 && lhs2, lhs2 instanceof rhs4 && lhs2, lhs2 instanceof rhs5 && lhs2, lhs2 instanceof Rhs7 && lhs2, lhs2 instanceof Rhs8 && lhs2, lhs2 instanceof Rhs9 && lhs2, lhs2 instanceof Rhs10 && lhs2, lhs2 instanceof Rhs11 && lhs2, lhs2 instanceof Rhs12 && lhs2, lhs3 instanceof rhs0 && lhs3, lhs3 instanceof rhs1 && lhs3, lhs3 instanceof rhs2 && lhs3, lhs3 instanceof rhs3 && lhs3, lhs3 instanceof rhs4 && lhs3, lhs3 instanceof rhs5 && lhs3, lhs3 instanceof rhs6 && lhs3, lhs3 instanceof Rhs7 && lhs3, lhs3 instanceof Rhs8 && lhs3, lhs3 instanceof Rhs9 && lhs3, lhs3 instanceof Rhs10 && lhs3, lhs3 instanceof Rhs11 && lhs3, lhs3 instanceof Rhs12 && lhs3, lhs3 instanceof Rhs13 && lhs3, lhs4 instanceof rhs0 && lhs4, lhs4 instanceof rhs1 && lhs4, lhs4 instanceof rhs2 && lhs4, lhs4 instanceof rhs3 && lhs4, lhs4 instanceof rhs4 && lhs4, lhs4 instanceof rhs5 && lhs4, lhs4 instanceof Rhs7 && lhs4, lhs4 instanceof Rhs8 && lhs4, lhs4 instanceof Rhs9 && lhs4, lhs4 instanceof Rhs10 && lhs4, lhs4 instanceof Rhs11 && lhs4, lhs4 instanceof Rhs12 && lhs4, obj instanceof A && obj, obj instanceof B && obj;
lhs0 instanceof rhs0 && lhs0, lhs0 instanceof rhs1 && lhs0, lhs0 instanceof rhs2 && lhs0, lhs0 instanceof rhs3 && lhs0, lhs0 instanceof rhs4 && lhs0, lhs0 instanceof rhs5 && lhs0, lhs0 instanceof rhs6 && lhs0, lhs0 instanceof Rhs7 && lhs0, lhs0 instanceof Rhs8 && lhs0, lhs0 instanceof Rhs9 && lhs0, lhs0 instanceof Rhs10 && lhs0, lhs0 instanceof Rhs11 && lhs0, lhs0 instanceof Rhs12 && lhs0, lhs0 instanceof Rhs13 && lhs0, lhs1 instanceof rhs0 && lhs1, lhs1 instanceof rhs1 && lhs1, lhs1 instanceof rhs2 && lhs1, lhs1 instanceof Rhs7 && lhs1, lhs1 instanceof Rhs8 && lhs1, lhs1 instanceof Rhs9 && lhs1, lhs2 instanceof rhs0 && lhs2, lhs2 instanceof rhs1 && lhs2, lhs2 instanceof rhs2 && lhs2, lhs2 instanceof rhs3 && lhs2, lhs2 instanceof rhs4 && lhs2, lhs2 instanceof rhs5 && lhs2, lhs2 instanceof Rhs7 && lhs2, lhs2 instanceof Rhs8 && lhs2, lhs2 instanceof Rhs9 && lhs2, lhs2 instanceof Rhs10 && lhs2, lhs2 instanceof Rhs11 && lhs2, lhs2 instanceof Rhs12 && lhs2, lhs3 instanceof rhs0 && lhs3, lhs3 instanceof rhs1 && lhs3, lhs3 instanceof rhs2 && lhs3, lhs3 instanceof rhs3 && lhs3, lhs3 instanceof rhs4 && lhs3, lhs3 instanceof rhs5 && lhs3, lhs3 instanceof rhs6 && lhs3, lhs3 instanceof Rhs7 && lhs3, lhs3 instanceof Rhs8 && lhs3, lhs3 instanceof Rhs9 && lhs3, lhs3 instanceof Rhs10 && lhs3, lhs3 instanceof Rhs11 && lhs3, lhs3 instanceof Rhs12 && lhs3, lhs3 instanceof Rhs13 && lhs3, lhs4 instanceof rhs0 && lhs4, lhs4 instanceof rhs1 && lhs4, lhs4 instanceof rhs2 && lhs4, lhs4 instanceof rhs3 && lhs4, lhs4 instanceof rhs4 && lhs4, lhs4 instanceof rhs5 && lhs4, lhs4 instanceof Rhs7 && lhs4, lhs4 instanceof Rhs8 && lhs4, lhs4 instanceof Rhs9 && lhs4, lhs4 instanceof Rhs10 && lhs4, lhs4 instanceof Rhs11 && lhs4, lhs4 instanceof Rhs12 && lhs4, obj instanceof A && obj, obj instanceof B && obj, lhs0 instanceof rhs14 && lhs0, lhs0 instanceof rhs15 && lhs0;

View File

@ -0,0 +1,4 @@
//// [intlDateTimeFormatRangeES2021.ts]
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
new Intl.DateTimeFormat().formatRange(new Date(0), new Date());
var _formatRangeToParts = _sliced_to_array(new Intl.DateTimeFormat().formatRangeToParts(1000, 1000000000), 1), part = _formatRangeToParts[0];

View File

@ -0,0 +1,3 @@
//// [intlDateTimeFormatRangeES2021.ts]
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
new Intl.DateTimeFormat().formatRange(new Date(0), new Date()), _sliced_to_array(new Intl.DateTimeFormat().formatRangeToParts(1000, 1000000000), 1)[0];

View File

@ -0,0 +1,36 @@
//// [intlNumberFormatES2020.ts]
// New/updated resolved options in ES2020
const { notation, style, signDisplay } = new Intl.NumberFormat('en-NZ').resolvedOptions();
// Empty options
new Intl.NumberFormat('en-NZ', {});
// Override numbering system
new Intl.NumberFormat('en-NZ', {
numberingSystem: 'arab'
});
// Currency
const { currency, currencySign } = new Intl.NumberFormat('en-NZ', {
style: 'currency',
currency: 'NZD',
currencySign: 'accounting'
}).resolvedOptions();
// Units
const { unit, unitDisplay } = new Intl.NumberFormat('en-NZ', {
style: 'unit',
unit: 'kilogram',
unitDisplay: 'narrow'
}).resolvedOptions();
// Compact
const { compactDisplay } = new Intl.NumberFormat('en-NZ', {
notation: 'compact',
compactDisplay: 'long'
}).resolvedOptions();
// Sign display
new Intl.NumberFormat('en-NZ', {
signDisplay: 'always'
});
// New additions to NumberFormatPartTypes
const types = [
'compact',
'unit',
'unknown'
];

View File

@ -0,0 +1,20 @@
//// [intlNumberFormatES2020.ts]
const { notation, style, signDisplay } = new Intl.NumberFormat('en-NZ').resolvedOptions();
new Intl.NumberFormat('en-NZ', {}), new Intl.NumberFormat('en-NZ', {
numberingSystem: 'arab'
});
const { currency, currencySign } = new Intl.NumberFormat('en-NZ', {
style: 'currency',
currency: 'NZD',
currencySign: 'accounting'
}).resolvedOptions(), { unit, unitDisplay } = new Intl.NumberFormat('en-NZ', {
style: 'unit',
unit: 'kilogram',
unitDisplay: 'narrow'
}).resolvedOptions(), { compactDisplay } = new Intl.NumberFormat('en-NZ', {
notation: 'compact',
compactDisplay: 'long'
}).resolvedOptions();
new Intl.NumberFormat('en-NZ', {
signDisplay: 'always'
});

View File

@ -0,0 +1,37 @@
//// [intlNumberFormatES2023.ts]
// New / updated resolved options in ES2023, including type change for useGrouping
const { roundingPriority, roundingMode, roundingIncrement, trailingZeroDisplay, useGrouping } = new Intl.NumberFormat('en-GB').resolvedOptions();
// Empty options
new Intl.NumberFormat('en-GB', {});
// Rounding
new Intl.NumberFormat('en-GB', {
roundingPriority: 'lessPrecision',
roundingIncrement: 100,
roundingMode: 'trunc'
});
// Changes to signDisplay
const { signDisplay } = new Intl.NumberFormat('en-GB', {
signDisplay: 'negative'
}).resolvedOptions();
// Changes to useGrouping
new Intl.NumberFormat('en-GB', {
useGrouping: true
});
new Intl.NumberFormat('en-GB', {
useGrouping: 'true'
});
new Intl.NumberFormat('en-GB', {
useGrouping: 'always'
});
// formatRange
new Intl.NumberFormat('en-GB').formatRange(10, 100);
new Intl.NumberFormat('en-GB').formatRange(10n, 1000n);
new Intl.NumberFormat('en-GB').formatRangeToParts(10, 1000)[0];
new Intl.NumberFormat('en-GB').formatRangeToParts(10n, 1000n)[0];
// Arbitrary-precision string arguments
new Intl.NumberFormat('en-GB').format('-12.3E-4');
new Intl.NumberFormat('en-GB').formatRange('123.4', '567.8');
new Intl.NumberFormat('en-GB').formatRangeToParts('123E-4', '567E8');
new Intl.NumberFormat('en-GB').format('Infinity');
new Intl.NumberFormat('en-GB').format('-Infinity');
new Intl.NumberFormat('en-GB').format('+Infinity');

View File

@ -0,0 +1,17 @@
//// [intlNumberFormatES2023.ts]
const { roundingPriority, roundingMode, roundingIncrement, trailingZeroDisplay, useGrouping } = new Intl.NumberFormat('en-GB').resolvedOptions();
new Intl.NumberFormat('en-GB', {}), new Intl.NumberFormat('en-GB', {
roundingPriority: 'lessPrecision',
roundingIncrement: 100,
roundingMode: 'trunc'
});
const { signDisplay } = new Intl.NumberFormat('en-GB', {
signDisplay: 'negative'
}).resolvedOptions();
new Intl.NumberFormat('en-GB', {
useGrouping: !0
}), new Intl.NumberFormat('en-GB', {
useGrouping: 'true'
}), new Intl.NumberFormat('en-GB', {
useGrouping: 'always'
}), new Intl.NumberFormat('en-GB').formatRange(10, 100), new Intl.NumberFormat('en-GB').formatRange(10n, 1000n), new Intl.NumberFormat('en-GB').formatRangeToParts(10, 1000)[0], new Intl.NumberFormat('en-GB').formatRangeToParts(10n, 1000n)[0], new Intl.NumberFormat('en-GB').format('-12.3E-4'), new Intl.NumberFormat('en-GB').formatRange('123.4', '567.8'), new Intl.NumberFormat('en-GB').formatRangeToParts('123E-4', '567E8'), new Intl.NumberFormat('en-GB').format('Infinity'), new Intl.NumberFormat('en-GB').format('-Infinity'), new Intl.NumberFormat('en-GB').format('+Infinity');

View File

@ -0,0 +1,11 @@
//// [intlNumberFormatES5UseGrouping.ts]
new Intl.NumberFormat("en-GB", {
useGrouping: true
});
new Intl.NumberFormat("en-GB", {
useGrouping: "true"
}); // expect error
new Intl.NumberFormat("en-GB", {
useGrouping: "always"
}); // expect error
var useGrouping = new Intl.NumberFormat("en-GB").resolvedOptions().useGrouping;

View File

@ -0,0 +1,8 @@
//// [intlNumberFormatES5UseGrouping.ts]
new Intl.NumberFormat("en-GB", {
useGrouping: !0
}), new Intl.NumberFormat("en-GB", {
useGrouping: "true"
}), new Intl.NumberFormat("en-GB", {
useGrouping: "always"
}), new Intl.NumberFormat("en-GB").resolvedOptions().useGrouping;

View File

@ -1,11 +1,11 @@
//// [file1.ts]
/// <reference lib="dom" />
/// <reference lib="dom" preserve="true" />
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//// [file2.ts]
/// <reference lib="dom" />
/// <reference lib="dom" preserve="true" />
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true

View File

@ -1,5 +1,5 @@
//// [file1.ts]
/// <reference lib="dom" />
/// <reference lib="dom" preserve="true" />
define([
"require",
"exports"
@ -10,7 +10,7 @@ define([
});
});
//// [file2.ts]
/// <reference lib="dom" />
/// <reference lib="dom" preserve="true" />
define([
"require",
"exports"

View File

@ -0,0 +1,10 @@
//// [mappedTypesGenericTuples2.ts]
// https://github.com/microsoft/TypeScript/issues/57389
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
Promise.all([
getT()
].concat(_to_consumable_array(getT()))).then(function(result) {
var head = result[0]; // string
var tail = result.slice(1); // any[]
tail; // ok
});

View File

@ -0,0 +1,7 @@
//// [mappedTypesGenericTuples2.ts]
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
Promise.all([
getT()
].concat(_to_consumable_array(getT()))).then(function(result) {
result[0], result.slice(1);
});

View File

@ -0,0 +1,15 @@
//// [parser.numericSeparators.decimal.ts]
1000000000;
1.10001;
1e10;
1e+10;
1e-10;
1.1e100;
1.1e+100;
1.1e-100;
123456;
122333;
12.34;
12.34e56;
12.34e+56;
12.34e-56;

View File

@ -0,0 +1 @@
//// [parser.numericSeparators.decimal.ts]

View File

@ -0,0 +1,15 @@
//// [parser.numericSeparators.decimal.ts]
1_000_000_000;
1.1_00_01;
1e1_0;
1e+1_0;
1e-1_0;
1.1e10_0;
1.1e+10_0;
1.1e-10_0;
12_34_56;
1_22_333;
1_2.3_4;
1_2.3_4e5_6;
1_2.3_4e+5_6;
1_2.3_4e-5_6;

View File

@ -0,0 +1 @@
//// [parser.numericSeparators.decimal.ts]

View File

@ -0,0 +1,15 @@
//// [parser.numericSeparators.decimal.ts]
1000000000;
1.10001;
1e10;
1e+10;
1e-10;
1.1e100;
1.1e+100;
1.1e-100;
123456;
122333;
12.34;
12.34e56;
12.34e+56;
12.34e-56;

View File

@ -0,0 +1 @@
//// [parser.numericSeparators.decimal.ts]

View File

@ -0,0 +1,7 @@
//// [parserArrowFunctionExpression10.ts]
//// [fileJs.js]
a ? (b)=>d : (e)=>f // Not legal JS; "Unexpected token ':'" at last colon
// Not legal JS; "Unexpected token ':'" at last colon
;
//// [fileTs.ts]
a ? (b)=>d : (e)=>f;

View File

@ -0,0 +1,5 @@
//// [parserArrowFunctionExpression10.ts]
//// [fileJs.js]
a || ((e)=>f);
//// [fileTs.ts]
a || ((e)=>f);

View File

@ -0,0 +1,16 @@
//// [parserArrowFunctionExpression11.ts]
//// [fileJs.js]
//!
//! x Expected ':', got '<eof>'
//! ,-[1:1]
//! 1 | a ? b ? c : (d) : e => f // Legal JS
//! : ^
//! 2 |
//! `----
//// [fileTs.ts]
//!
//! x Expected ':', got '<eof>'
//! ,----
//! 1 | a ? b ? c : (d) : e => f
//! : ^
//! `----

View File

@ -0,0 +1,16 @@
//// [parserArrowFunctionExpression11.ts]
//// [fileJs.js]
//!
//! x Expected ':', got '<eof>'
//! ,-[1:1]
//! 1 | a ? b ? c : (d) : e => f // Legal JS
//! : ^
//! 2 |
//! `----
//// [fileTs.ts]
//!
//! x Expected ':', got '<eof>'
//! ,----
//! 1 | a ? b ? c : (d) : e => f
//! : ^
//! `----

View File

@ -0,0 +1,7 @@
//// [parserArrowFunctionExpression12.ts]
//// [fileJs.js]
a ? (b)=>c : (d)=>e // Legal JS
// Legal JS
;
//// [fileTs.ts]
a ? (b)=>c : (d)=>e;

View File

@ -0,0 +1,5 @@
//// [parserArrowFunctionExpression12.ts]
//// [fileJs.js]
a || ((d)=>e);
//// [fileTs.ts]
a || ((d)=>e);

View File

@ -0,0 +1,5 @@
//// [parserArrowFunctionExpression13.ts]
//// [fileJs.js]
a ? ()=>a() : ()=>null; // Not legal JS; "Unexpected token ')'" at last paren
//// [fileTs.ts]
a ? ()=>a() : ()=>null;

View File

@ -0,0 +1,5 @@
//// [parserArrowFunctionExpression13.ts]
//// [fileJs.js]
a || (()=>null);
//// [fileTs.ts]
a || (()=>null);

View File

@ -0,0 +1,5 @@
//// [parserArrowFunctionExpression14.ts]
//// [fileJs.js]
a() ? (b, c)=>d() : e; // Not legal JS; "Unexpected token ':'" at first colon
//// [fileTs.ts]
a() ? (b, c)=>d() : e;

View File

@ -0,0 +1,5 @@
//// [parserArrowFunctionExpression14.ts]
//// [fileJs.js]
a() || e;
//// [fileTs.ts]
a() || e;

View File

@ -0,0 +1,6 @@
//// [parserArrowFunctionExpression15.ts]
//// [fileJs.js]
false ? (param)=>param : null // Not legal JS; "Unexpected token ':'" at last colon
;
//// [fileTs.ts]
false ? (param)=>param : null;

View File

@ -0,0 +1,3 @@
//// [parserArrowFunctionExpression15.ts]
//// [fileJs.js]
//// [fileTs.ts]

View File

@ -0,0 +1,6 @@
//// [parserArrowFunctionExpression16.ts]
//// [fileJs.js]
true ? false ? (param)=>param : null : null // Not legal JS; "Unexpected token ':'" at last colon
;
//// [fileTs.ts]
true ? false ? (param)=>param : null : null;

View File

@ -0,0 +1,3 @@
//// [parserArrowFunctionExpression16.ts]
//// [fileJs.js]
//// [fileTs.ts]

View File

@ -0,0 +1,6 @@
//// [parserArrowFunctionExpression17.ts]
//// [fileJs.js]
a ? b : (c)=>e // Not legal JS; "Unexpected token ':'" at last colon
;
//// [fileTs.ts]
a ? b : (c)=>e;

View File

@ -0,0 +1,5 @@
//// [parserArrowFunctionExpression17.ts]
//// [fileJs.js]
a && b;
//// [fileTs.ts]
a && b;

View File

@ -0,0 +1,15 @@
//// [parserArrowFunctionExpression8.ts]
//// [fileJs.js]
x ? (y)=>({
y
}) : (z)=>({
z
} // Legal JS
// Legal JS
);
//// [fileTs.ts]
x ? (y)=>({
y
}) : (z)=>({
z
});

View File

@ -0,0 +1,9 @@
//// [parserArrowFunctionExpression8.ts]
//// [fileJs.js]
x || ((z)=>({
z
}));
//// [fileTs.ts]
x || ((z)=>({
z
}));

View File

@ -0,0 +1,7 @@
//// [parserArrowFunctionExpression9.ts]
//// [fileJs.js]
b ? c : (d)=>e // Legal JS
// Legal JS
;
//// [fileTs.ts]
b ? c : (d)=>e;

View File

@ -0,0 +1,5 @@
//// [parserArrowFunctionExpression9.ts]
//// [fileJs.js]
b && c;
//// [fileTs.ts]
b && c;

View File

@ -0,0 +1,38 @@
//// [privateNameES5Ban.ts]
import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
import { _ as _class_private_field_init } from "@swc/helpers/_/_class_private_field_init";
import { _ as _class_private_field_set } from "@swc/helpers/_/_class_private_field_set";
import { _ as _class_private_method_init } from "@swc/helpers/_/_class_private_method_init";
var _field = /*#__PURE__*/ new WeakMap(), _method = /*#__PURE__*/ new WeakSet(), _acc = /*#__PURE__*/ new WeakMap();
var A = function A() {
"use strict";
_class_call_check(this, A);
_class_private_method_init(this, _method);
_class_private_field_init(this, _acc, {
get: get_acc,
set: set_acc
});
_class_private_field_init(this, _field, {
writable: true,
value: void 0
});
_class_private_field_set(this, _field, 123);
};
var _sAcc = {
get: get_sAcc,
set: set_sAcc
};
var _sField = {
writable: true,
value: "hello world"
};
function method() {}
function sMethod() {}
function get_acc() {
return "";
}
function set_acc(x) {}
function get_sAcc() {
return 0;
}
function set_sAcc(x) {}

View File

@ -0,0 +1,5 @@
//// [privateNameES5Ban.ts]
import "@swc/helpers/_/_class_call_check";
import "@swc/helpers/_/_class_private_field_init";
import "@swc/helpers/_/_class_private_field_set";
import "@swc/helpers/_/_class_private_method_init";

View File

@ -0,0 +1,13 @@
//// [spreadNonObject1.ts]
// https://github.com/microsoft/TypeScript/issues/45493
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
var b = {
c: [
"4"
].map(function(s) {
var a = _object_spread_props(_object_spread({}, s), {
y: 6
});
})
};

View File

@ -0,0 +1,10 @@
//// [spreadNonObject1.ts]
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
[
"4"
].map(function(s) {
_object_spread_props(_object_spread({}, s), {
y: 6
});
});

View File

@ -0,0 +1,8 @@
//// [templateLiteralTypes5.ts]
// https://github.com/microsoft/TypeScript/issues/55364
const f1 = f;
const f2 = f;
function f3(x) {
const test1 = x;
const test2 = "";
}

View File

@ -0,0 +1,2 @@
//// [templateLiteralTypes5.ts]
f, f;

View File

@ -0,0 +1,5 @@
//// [templateLiteralTypes6.ts]
// https://github.com/microsoft/TypeScript/issues/56659
function f2(scope, event) {
f1(`${scope}:${event}`);
}

Some files were not shown because too many files have changed in this diff Show More