From 5d675f77e05fb26d76c993bbe33bc966e135ba5a Mon Sep 17 00:00:00 2001 From: Florian Hammerschmidt Date: Wed, 3 Apr 2024 22:59:43 +0200 Subject: [PATCH] Use native bigint type (#207) * Use native bigint type * Changelog * Update to native built-in methods * Update test output * Fix a doctest * Fix dict error in docs test by upgrading even more * Fix changelog --- CHANGELOG.md | 2 + package-lock.json | 10 +- package.json | 6 +- scripts/DocTests.mjs | 6 +- scripts/DocTests.res | 2 +- src/Core__BigInt.mjs | 6 +- src/Core__BigInt.res | 112 +++++++++++++++------ src/Core__DataView.res | 8 +- src/Core__Type.res | 4 +- src/Core__Type.resi | 2 +- src/intl/Core__Intl__NumberFormat.res | 14 +-- src/intl/Core__Intl__PluralRules.res | 5 +- src/typed-arrays/Core__BigInt64Array.res | 7 +- src/typed-arrays/Core__BigUint64Array.res | 7 +- test/ObjectTests.mjs | 2 +- test/TempTests.mjs | 5 +- test/Test.mjs | 2 +- test/TypedArrayTests.res | 2 +- test/intl/Intl__CollatorTest.mjs | 4 +- test/intl/Intl__DateTimeFormatTest.mjs | 2 +- test/intl/Intl__ListFormatTest.mjs | 2 +- test/intl/Intl__NumberFormatTest.mjs | 2 +- test/intl/Intl__RelativeTimeFormatTest.mjs | 2 +- test/intl/Intl__SegmenterTest.mjs | 2 +- 24 files changed, 133 insertions(+), 83 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02ab06dd..5f87ada6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Next version +- BREAKING: Use new native `bigint` type. This requires ReScript compiler version "11.1.0-rc.6" or higher. https://github.com/rescript-association/rescript-core/pull/207 + ## 1.2.0 - Add optional arguments to `JSON.stringify` and `JSON.parseExn` and deprecate `JSON.stringifyWithIndent`, `JSON.stringifyWithReplacer`, `JSON.parseExnWithReviver` etc. https://github.com/rescript-association/rescript-core/pull/201 diff --git a/package-lock.json b/package-lock.json index 57765bad..b635e134 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,10 +11,10 @@ "devDependencies": { "@babel/code-frame": "7.18.6", "@rescript/tools": "^0.5.0", - "rescript": "11.1.0-rc.2" + "rescript": "^11.1.0-rc.7" }, "peerDependencies": { - "rescript": ">=11.0.0 || ^11.1.0-rc.2" + "rescript": "^11.1.0-rc.7" } }, "node_modules/@babel/code-frame": { @@ -148,9 +148,9 @@ "dev": true }, "node_modules/rescript": { - "version": "11.1.0-rc.2", - "resolved": "https://registry.npmjs.org/rescript/-/rescript-11.1.0-rc.2.tgz", - "integrity": "sha512-kCUtmsODEUF1Eth5ppc+yIK79HLI7CwRs1R4iopDek4FC58IqHSLT3K1XHGB39YCWuOuV9WMly+wksHRJcSLcw==", + "version": "11.1.0-rc.7", + "resolved": "https://registry.npmjs.org/rescript/-/rescript-11.1.0-rc.7.tgz", + "integrity": "sha512-4MsOugrSaS9Sh4grCVwNhOJLv1KZ7gTtN5KsV0ctPvzGyCaco7Ftwqo4uVap7xXuzLjgALPQdYBdElBgTZRvaQ==", "dev": true, "hasInstallScript": true, "bin": { diff --git a/package.json b/package.json index 054b22c8..f12c23ca 100644 --- a/package.json +++ b/package.json @@ -24,11 +24,11 @@ "src/**/*.mjs" ], "peerDependencies": { - "rescript": ">=11.0.0 || ^11.1.0-rc.2" + "rescript": "^11.1.0-rc.7" }, "devDependencies": { "@babel/code-frame": "7.18.6", "@rescript/tools": "^0.5.0", - "rescript": "11.1.0-rc.2" + "rescript": "^11.1.0-rc.7" } -} +} \ No newline at end of file diff --git a/scripts/DocTests.mjs b/scripts/DocTests.mjs index 4be7afab..1a3b4e7d 100644 --- a/scripts/DocTests.mjs +++ b/scripts/DocTests.mjs @@ -48,7 +48,7 @@ var bscBin = Path.join(compilerDir, "node_modules", ".bin", "bsc"); var rescriptCoreCompiled = Path.join(compilerDir, "node_modules", "@rescript", "core", "lib", "ocaml"); function makePackageJson(coreVersion) { - return "{\n \"name\": \"test-compiler-examples\",\n \"version\": \"1.0.0\",\n \"dependencies\": {\n \"@rescript/core\": \"file:rescript-core-" + coreVersion + ".tgz\",\n \"rescript\": \"^11.0.1\"\n }\n}\n"; + return "{\n \"name\": \"test-compiler-examples\",\n \"version\": \"1.0.0\",\n \"dependencies\": {\n \"@rescript/core\": \"file:rescript-core-" + coreVersion + ".tgz\",\n \"rescript\": \"11.1.0-rc.7\"\n }\n}\n"; } var rescriptJson = "{\n \"name\": \"dummy\",\n \"sources\": {\n \"dir\": \"dummy\",\n \"subdirs\": true\n },\n \"bs-dependencies\": [\n \"@rescript/core\"\n ],\n \"bsc-flags\": [\n \"-open RescriptCore\"\n ]\n}"; @@ -65,7 +65,7 @@ function prepareCompiler() { stdio: "ignore", cwd: compilerDir }); - var dict = JSON.parse(Fs.readFileSync(Path.join(corePath, "package.json")), undefined); + var dict = JSON.parse(Fs.readFileSync(Path.join(corePath, "package.json"))); var currentCoreVersion; if (!Array.isArray(dict) && (dict === null || typeof dict !== "object") && typeof dict !== "number" && typeof dict !== "string" && typeof dict !== "boolean") { throw { @@ -179,7 +179,7 @@ function extractDocFromFile(file) { "doc", file ]); - return Tools_Docgen.decodeFromJson(JSON.parse(spawn.stdout.toString(), undefined)); + return Tools_Docgen.decodeFromJson(JSON.parse(spawn.stdout.toString())); } function getExamples(param) { diff --git a/scripts/DocTests.res b/scripts/DocTests.res index 0dcffe5d..3a448934 100644 --- a/scripts/DocTests.res +++ b/scripts/DocTests.res @@ -89,7 +89,7 @@ let makePackageJson = coreVersion => "version": "1.0.0", "dependencies": { "@rescript/core": "file:rescript-core-${coreVersion}.tgz", - "rescript": "^11.0.1" + "rescript": "11.1.0-rc.7" } } ` diff --git a/src/Core__BigInt.mjs b/src/Core__BigInt.mjs index 88c19a2e..56b7eda6 100644 --- a/src/Core__BigInt.mjs +++ b/src/Core__BigInt.mjs @@ -5,12 +5,12 @@ function toInt(t) { return Number(t) | 0; } -function exp(x, y) { - return (x ** y); +function lnot(x) { + return x ^ -1n; } export { toInt , - exp , + lnot , } /* No side effect */ diff --git a/src/Core__BigInt.res b/src/Core__BigInt.res index 2f2ab991..bb5fca10 100644 --- a/src/Core__BigInt.res +++ b/src/Core__BigInt.res @@ -1,41 +1,95 @@ -type t = Js.Types.bigint_val +@val external asIntN: (~width: int, bigint) => bigint = "BigInt.asIntN" +@val external asUintN: (~width: int, bigint) => bigint = "BigInt.asUintN" -@val external asIntN: (~width: int, t) => t = "BigInt.asIntN" -@val external asUintN: (~width: int, t) => t = "BigInt.asUintN" +@val external fromString: string => bigint = "BigInt" -@val external fromString: string => t = "BigInt" -@val external fromInt: int => t = "BigInt" -@val external fromFloat: float => t = "BigInt" +@val +/** +Parses the given `string` into a `bigint` using JavaScript semantics. Return the +number as a `bigint` if successfully parsed. Uncaught syntax exception otherwise. -@send external toString: t => string = "toString" -@send external toStringWithRadix: (t, ~radix: int) => string = "toString" -@send external toLocaleString: t => string = "toLocaleString" +## Examples -@val external toFloat: t => float = "Number" +```rescript +/* returns 123n */ +BigInt.fromStringExn("123") + +/* returns 0n */ +BigInt.fromStringExn("") + +/* returns 17n */ +BigInt.fromStringExn("0x11") + +/* returns 3n */ +BigInt.fromStringExn("0b11") + +/* returns 9n */ +BigInt.fromStringExn("0o11") + +/* catch exception */ +try { + BigInt.fromStringExn("a") +} catch { +| Exn.Error(_error) => 0n +} +``` +*/ +external fromStringExn: string => bigint = "BigInt" +@val external fromInt: int => bigint = "BigInt" +@val external fromFloat: float => bigint = "BigInt" + +@send +/** +Formats a `bigint` as a string. Return a `string` representing the given value. +See [`toString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toString) on MDN. + +## Examples + +```rescript +/* prints "123" */ +Js.BigInt.toString(123n)->Js.log +``` +*/ +external toString: bigint => string = "toString" +@send external toStringWithRadix: (bigint, ~radix: int) => string = "toString" + +@send +/** +Returns a string with a language-sensitive representation of this BigInt value. + +## Examples + +```rescript +/* prints "123" */ +Js.BigInt.toString(123n)->Js.log +``` +*/ +external toLocaleString: bigint => string = "toLocaleString" + +@val external toFloat: bigint => float = "Number" let toInt = t => t->toFloat->Core__Int.fromFloat -external \"+": (t, t) => t = "%addfloat" -external \"-": (t, t) => t = "%subfloat" -external \"*": (t, t) => t = "%mulfloat" -external \"/": (t, t) => t = "%divfloat" +external \"+": (bigint, bigint) => bigint = "%addbigint" +external \"-": (bigint, bigint) => bigint = "%subbigint" +external \"*": (bigint, bigint) => bigint = "%mulbigint" +external \"/": (bigint, bigint) => bigint = "%divbigint" +external \"~-": bigint => bigint = "%negbigint" +external \"~+": bigint => bigint = "%identity" +external \"**": (bigint, bigint) => bigint = "%powbigint" -external add: (t, t) => t = "%addfloat" -external sub: (t, t) => t = "%subfloat" -external mul: (t, t) => t = "%mulfloat" -external div: (t, t) => t = "%divfloat" +external add: (bigint, bigint) => bigint = "%addfloat" +external sub: (bigint, bigint) => bigint = "%subfloat" +external mul: (bigint, bigint) => bigint = "%mulfloat" +external div: (bigint, bigint) => bigint = "%divfloat" -@noalloc external mod: (t, t) => t = "?fmod_float" +external mod: (bigint, bigint) => bigint = "%modbigint" -external land: (t, t) => t = "%andint" -external lor: (t, t) => t = "%orint" -external lxor: (t, t) => t = "%xorint" +external land: (bigint, bigint) => bigint = "%andbigint" +external lor: (bigint, bigint) => bigint = "%orbigint" +external lxor: (bigint, bigint) => bigint = "%xorbigint" -external lsl: (t, t) => t = "%lslint" -external asr: (t, t) => t = "%asrint" +external lsl: (bigint, bigint) => bigint = "%lslbigint" +external asr: (bigint, bigint) => bigint = "%asrbigint" -let exp = (x: t, y: t) => { - let _ = x - let _ = y - %raw(`x ** y`) -} +let lnot = x => lxor(x, -1n) diff --git a/src/Core__DataView.res b/src/Core__DataView.res index c40c92ad..83e09368 100644 --- a/src/Core__DataView.res +++ b/src/Core__DataView.res @@ -20,8 +20,8 @@ external fromBufferWithRange: (Core__ArrayBuffer.t, ~byteOffset: int, ~length: i @send external getFloat32: t => float = "getFloat32" @send external getFloat64: t => float = "getFloat64" -@send external getBigInt64: t => Core__BigInt.t = "getBigInt64" -@send external getBigUint64: t => Core__BigInt.t = "getBigUint64" +@send external getBigInt64: t => bigint = "getBigInt64" +@send external getBigUint64: t => bigint = "getBigUint64" @send external setInt8: (t, int) => unit = "setInt8" @send external setUint8: (t, int) => unit = "setUint8" @@ -33,5 +33,5 @@ external fromBufferWithRange: (Core__ArrayBuffer.t, ~byteOffset: int, ~length: i @send external setFloat32: (t, float) => unit = "setFloat32" @send external setFloat64: (t, float) => unit = "setFloat64" -@send external setBigInt64: (t, Core__BigInt.t) => unit = "setBigInt64" -@send external setBigUint64: (t, Core__BigInt.t) => unit = "setBigUint64" +@send external setBigInt64: (t, bigint) => unit = "setBigInt64" +@send external setBigUint64: (t, bigint) => unit = "setBigUint64" diff --git a/src/Core__Type.res b/src/Core__Type.res index 4680f491..3e89dacd 100644 --- a/src/Core__Type.res +++ b/src/Core__Type.res @@ -15,7 +15,7 @@ module Classify = { | Object(object) | Function(function) | Symbol(Core__Symbol.t) - | BigInt(Core__BigInt.t) + | BigInt(bigint) @val external _internalClass: 'a => string = "Object.prototype.toString.call" external _asBool: 'a => bool = "%identity" @@ -24,7 +24,7 @@ module Classify = { external _asObject: 'a => object = "%identity" external _asFunction: 'a => function = "%identity" external _asSymbol: 'a => Core__Symbol.t = "%identity" - external _asBigInt: 'a => Core__BigInt.t = "%identity" + external _asBigInt: 'a => bigint = "%identity" let classify = value => { switch _internalClass(value) { diff --git a/src/Core__Type.resi b/src/Core__Type.resi index c5d1d9be..35820cff 100644 --- a/src/Core__Type.resi +++ b/src/Core__Type.resi @@ -59,7 +59,7 @@ module Classify: { | Object(object) | Function(function) | Symbol(Core__Symbol.t) - | BigInt(Core__BigInt.t) + | BigInt(bigint) /** `classify(anyValue)` diff --git a/src/intl/Core__Intl__NumberFormat.res b/src/intl/Core__Intl__NumberFormat.res index 3929e8cf..befcc891 100644 --- a/src/intl/Core__Intl__NumberFormat.res +++ b/src/intl/Core__Intl__NumberFormat.res @@ -194,20 +194,16 @@ external formatIntToParts: (t, int) => array = "formatToParts" external formatIntRangeToParts: (t, ~start: int, ~end: int) => array = "formatRange" -@send external formatBigInt: (t, Core__BigInt.t) => string = "format" +@send external formatBigInt: (t, bigint) => string = "format" @send -external formatBigIntRange: (t, ~start: Core__BigInt.t, ~end: Core__BigInt.t) => array = - "formatRange" +external formatBigIntRange: (t, ~start: bigint, ~end: bigint) => array = "formatRange" @send -external formatBigIntToParts: (t, Core__BigInt.t) => array = "formatToParts" +external formatBigIntToParts: (t, bigint) => array = "formatToParts" @send -external formatBigIntRangeToParts: ( - t, - ~start: Core__BigInt.t, - ~end: Core__BigInt.t, -) => array = "formatRange" +external formatBigIntRangeToParts: (t, ~start: bigint, ~end: bigint) => array = + "formatRange" @send external formatString: (t, string) => string = "format" diff --git a/src/intl/Core__Intl__PluralRules.res b/src/intl/Core__Intl__PluralRules.res index 7831df0a..f69756ed 100644 --- a/src/intl/Core__Intl__PluralRules.res +++ b/src/intl/Core__Intl__PluralRules.res @@ -50,7 +50,7 @@ type rule = [#zero | #one | #two | #few | #many | #other] @send external select: (t, float) => rule = "select" @send external selectInt: (t, int) => rule = "select" -@send external selectBigInt: (t, Core__BigInt.t) => rule = "select" +@send external selectBigInt: (t, bigint) => rule = "select" @send external selectRange: (t, ~start: float, ~end: float) => rule = "selectRange" @@ -59,5 +59,4 @@ external selectRange: (t, ~start: float, ~end: float) => rule = "selectRange" external selectRangeInt: (t, ~start: int, ~end: int) => rule = "selectRange" @send -external selectRangeBigInt: (t, ~start: Core__BigInt.t, ~end: Core__BigInt.t) => rule = - "selectRange" +external selectRangeBigInt: (t, ~start: bigint, ~end: bigint) => rule = "selectRange" diff --git a/src/typed-arrays/Core__BigInt64Array.res b/src/typed-arrays/Core__BigInt64Array.res index 96b0e792..ba327c35 100644 --- a/src/typed-arrays/Core__BigInt64Array.res +++ b/src/typed-arrays/Core__BigInt64Array.res @@ -1,6 +1,6 @@ /** The `BigInt64Array` typed array represents an array of 64-bit signed integers in platform byte order. See [BigInt64Array on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt64Array) */ -type t = Core__TypedArray.t +type t = Core__TypedArray.t module Constants = { /**`bytesPerElement` returns the element size. See [BYTES_PER_ELEMENT on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT) @@ -12,7 +12,7 @@ module Constants = { /** `fromArray` creates a `BigInt64Array` from an array of values. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt64Array/BigInt64Array) */ @new -external fromArray: array => t = "BigInt64Array" +external fromArray: array => t = "BigInt64Array" /** `fromBuffer` creates a `BigInt64Array` from an `ArrayBuffer.t`. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt64Array/BigInt64Array) @@ -51,5 +51,4 @@ external fromArrayLikeOrIterable: 'a => t = "BigInt64Array.from" /** `fromArrayLikeOrIterableWithMap` creates a `BigInt64Array` from an array-like or iterable object and applies the mapping function to each item. The mapping function expects (value, index). See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from) */ @val -external fromArrayLikeOrIterableWithMap: ('a, ('b, int) => Core__BigInt.t) => t = - "BigInt64Array.from" +external fromArrayLikeOrIterableWithMap: ('a, ('b, int) => bigint) => t = "BigInt64Array.from" diff --git a/src/typed-arrays/Core__BigUint64Array.res b/src/typed-arrays/Core__BigUint64Array.res index f0b6ac53..3e2e2a47 100644 --- a/src/typed-arrays/Core__BigUint64Array.res +++ b/src/typed-arrays/Core__BigUint64Array.res @@ -1,6 +1,6 @@ /** The `BigUint64Array` typed array represents an array of 64-bit unsigned integers in platform byte order. See [BigUint64Array on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigUint64Array) */ -type t = Core__TypedArray.t +type t = Core__TypedArray.t module Constants = { /**`bytesPerElement` returns the element size. See [BYTES_PER_ELEMENT on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/BYTES_PER_ELEMENT) @@ -12,7 +12,7 @@ module Constants = { /** `fromArray` creates a `BigUint64Array` from an array of values. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigUint64Array/BigUint64Array) */ @new -external fromArray: array => t = "BigUint64Array" +external fromArray: array => t = "BigUint64Array" /** `fromBuffer` creates a `BigUint64Array` from an `ArrayBuffer.t`. See [TypedArray constructor on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigUint64Array/BigUint64Array) @@ -51,5 +51,4 @@ external fromArrayLikeOrIterable: 'a => t = "BigUint64Array.from" /** `fromArrayLikeOrIterableWithMap` creates a `BigUint64Array` from an array-like or iterable object and applies the mapping function to each item. The mapping function expects (value, index). See [TypedArray.from on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/from) */ @val -external fromArrayLikeOrIterableWithMap: ('a, ('b, int) => Core__BigInt.t) => t = - "BigUint64Array.from" +external fromArrayLikeOrIterableWithMap: ('a, ('b, int) => bigint) => t = "BigUint64Array.from" diff --git a/test/ObjectTests.mjs b/test/ObjectTests.mjs index 2ad5a9a1..fd6355a2 100644 --- a/test/ObjectTests.mjs +++ b/test/ObjectTests.mjs @@ -386,7 +386,7 @@ Test.run([ 32 ], "is: bigint" - ], Caml_obj.equal(BigInt("123"), BigInt("123")), eq, true); + ], BigInt("123") === BigInt("123"), eq, true); Test.run([ [ diff --git a/test/TempTests.mjs b/test/TempTests.mjs index 5a6c5551..47409903 100644 --- a/test/TempTests.mjs +++ b/test/TempTests.mjs @@ -4,6 +4,7 @@ import * as Core__Int from "../src/Core__Int.mjs"; import * as IntlTests from "./intl/IntlTests.mjs"; import * as Core__Dict from "../src/Core__Dict.mjs"; import * as Core__JSON from "../src/Core__JSON.mjs"; +import * as Caml_bigint from "rescript/lib/es6/caml_bigint.js"; import * as Caml_option from "rescript/lib/es6/caml_option.js"; import * as Core__Array from "../src/Core__Array.mjs"; import * as Core__Float from "../src/Core__Float.mjs"; @@ -98,7 +99,7 @@ console.info("JSON"); console.info("---"); -var json = JSON.parse("{\"foo\": \"bar\"}", undefined); +var json = JSON.parse("{\"foo\": \"bar\"}"); var json$1 = Core__JSON.Classify.classify(json); @@ -143,7 +144,7 @@ console.info("BigInt"); console.info("---"); -console.log(BigInt(1) / BigInt(12.0)); +console.log(Caml_bigint.div(BigInt(1), BigInt(12.0))); console.info(""); diff --git a/test/Test.mjs b/test/Test.mjs index 170e6501..1fe28b2a 100644 --- a/test/Test.mjs +++ b/test/Test.mjs @@ -13,7 +13,7 @@ function print(value) { if (match === "object" || match === "bigint") { return Util.inspect(value); } else if (match === "string") { - return Core__Option.getExn(JSON.stringify(value, undefined, undefined)); + return Core__Option.getExn(JSON.stringify(value)); } else { return String(value); } diff --git a/test/TypedArrayTests.res b/test/TypedArrayTests.res index 91608e3a..746a18c2 100644 --- a/test/TypedArrayTests.res +++ b/test/TypedArrayTests.res @@ -32,7 +32,7 @@ let assertWillThrow = (message, f) => { } } -let areSame = (x: BigInt.t, y: BigInt.t) => BigInt.toString(x) == BigInt.toString(y) +let areSame = (x: bigint, y: bigint) => BigInt.toString(x) == BigInt.toString(y) // What's going on here? // assertTrue("big ints if different then not equal", () => num1 != num2) diff --git a/test/intl/Intl__CollatorTest.mjs b/test/intl/Intl__CollatorTest.mjs index a42c8e08..1548f993 100644 --- a/test/intl/Intl__CollatorTest.mjs +++ b/test/intl/Intl__CollatorTest.mjs @@ -24,7 +24,7 @@ var collator = new Intl.Collator(["en-US"], { Intl.Collator.supportedLocalesOf([ "en-US", "en-GB" - ], undefined); + ]); Intl.Collator.supportedLocalesOf([ "en-US", @@ -37,7 +37,7 @@ console.log(collator.resolvedOptions()); console.log(collator.compare("hi", "hï")); -console.log(Intl.Collator.supportedLocalesOf(["hi"], undefined)); +console.log(Intl.Collator.supportedLocalesOf(["hi"])); export { _collator , diff --git a/test/intl/Intl__DateTimeFormatTest.mjs b/test/intl/Intl__DateTimeFormatTest.mjs index 62e31e91..2d95e6d9 100644 --- a/test/intl/Intl__DateTimeFormatTest.mjs +++ b/test/intl/Intl__DateTimeFormatTest.mjs @@ -9,7 +9,7 @@ console.log("Intl.DateTimeFormat"); Intl.DateTimeFormat.supportedLocalesOf([ "en-US", "en-GB" - ], undefined); + ]); Intl.DateTimeFormat.supportedLocalesOf([ "en-US", diff --git a/test/intl/Intl__ListFormatTest.mjs b/test/intl/Intl__ListFormatTest.mjs index f4bb15e8..70d37c18 100644 --- a/test/intl/Intl__ListFormatTest.mjs +++ b/test/intl/Intl__ListFormatTest.mjs @@ -23,7 +23,7 @@ var _formatter = new Intl.ListFormat([ Intl.ListFormat.supportedLocalesOf([ "en-US", "en-GB" - ], undefined); + ]); Intl.ListFormat.supportedLocalesOf([ "en-US", diff --git a/test/intl/Intl__NumberFormatTest.mjs b/test/intl/Intl__NumberFormatTest.mjs index 9f8e02d9..dfde8138 100644 --- a/test/intl/Intl__NumberFormatTest.mjs +++ b/test/intl/Intl__NumberFormatTest.mjs @@ -15,7 +15,7 @@ var currencyFormatter = new Intl.NumberFormat(["fr-FR"], { console.log(Intl.NumberFormat.supportedLocalesOf([ "fr-FR", "en-US" - ], undefined)); + ])); console.log(currencyFormatter.format(123.23)); diff --git a/test/intl/Intl__RelativeTimeFormatTest.mjs b/test/intl/Intl__RelativeTimeFormatTest.mjs index 2afbbac3..9575d4e5 100644 --- a/test/intl/Intl__RelativeTimeFormatTest.mjs +++ b/test/intl/Intl__RelativeTimeFormatTest.mjs @@ -8,7 +8,7 @@ console.log("Intl.RelativeTimeFormat"); Intl.RelativeTimeFormat.supportedLocalesOf([ "en-US", "en-GB" - ], undefined); + ]); Intl.RelativeTimeFormat.supportedLocalesOf([ "en-US", diff --git a/test/intl/Intl__SegmenterTest.mjs b/test/intl/Intl__SegmenterTest.mjs index c1d6ecf0..707b4009 100644 --- a/test/intl/Intl__SegmenterTest.mjs +++ b/test/intl/Intl__SegmenterTest.mjs @@ -8,7 +8,7 @@ console.log("Intl.Segmenter"); Intl.Segmenter.supportedLocalesOf([ "en-US", "en-GB" - ], undefined); + ]); Intl.Segmenter.supportedLocalesOf([ "en-US",