Skip to content

Commit 5f6ccf3

Browse files
authored
add ignore for every stdlib type t (#7348)
* add ignore for every stdlib type t (fixes rescript-lang/rescript-core#239) * ignore generated_mocha_test for formatting
1 parent 890ace4 commit 5f6ccf3

File tree

84 files changed

+552
-14
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+552
-14
lines changed

lib/es6/Stdlib.js

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22

33
import * as Stdlib_Error from "./Stdlib_Error.js";
4+
import * as Stdlib_Global from "./Stdlib_Global.js";
45
import * as Primitive_object from "./Primitive_object.js";
56

67
function assertEqual(a, b) {
@@ -18,6 +19,10 @@ function assertEqual(a, b) {
1819
};
1920
}
2021

22+
let TimeoutId = Stdlib_Global.TimeoutId;
23+
24+
let IntervalId = Stdlib_Global.IntervalId;
25+
2126
let $$Array;
2227

2328
let $$BigInt;
@@ -109,6 +114,8 @@ let $$BigUint64Array;
109114
let panic = Stdlib_Error.panic;
110115

111116
export {
117+
TimeoutId,
118+
IntervalId,
112119
$$Array,
113120
$$BigInt,
114121
Console,

lib/es6/Stdlib_Global.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
1-
/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */
1+
2+
3+
4+
let TimeoutId = {};
5+
6+
let IntervalId = {};
7+
8+
export {
9+
TimeoutId,
10+
IntervalId,
11+
}
12+
/* No side effect */

lib/js/Stdlib.js

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22

33
let Stdlib_Error = require("./Stdlib_Error.js");
4+
let Stdlib_Global = require("./Stdlib_Global.js");
45
let Primitive_object = require("./Primitive_object.js");
56

67
function assertEqual(a, b) {
@@ -18,6 +19,10 @@ function assertEqual(a, b) {
1819
};
1920
}
2021

22+
let TimeoutId = Stdlib_Global.TimeoutId;
23+
24+
let IntervalId = Stdlib_Global.IntervalId;
25+
2126
let $$Array;
2227

2328
let $$BigInt;
@@ -108,6 +113,8 @@ let $$BigUint64Array;
108113

109114
let panic = Stdlib_Error.panic;
110115

116+
exports.TimeoutId = TimeoutId;
117+
exports.IntervalId = IntervalId;
111118
exports.$$Array = $$Array;
112119
exports.$$BigInt = $$BigInt;
113120
exports.Console = Console;

lib/js/Stdlib_Global.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1-
/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */
1+
'use strict';
2+
3+
4+
let TimeoutId = {};
5+
6+
let IntervalId = {};
7+
8+
exports.TimeoutId = TimeoutId;
9+
exports.IntervalId = IntervalId;
10+
/* No side effect */

runtime/Stdlib_Array.res

+2
Original file line numberDiff line numberDiff line change
@@ -270,3 +270,5 @@ let findMap = (arr, f) => {
270270
@send external at: (array<'a>, int) => option<'a> = "at"
271271

272272
let last = a => a->get(a->length - 1)
273+
274+
external ignore: array<'a> => unit = "%ignore"

runtime/Stdlib_Array.resi

+8
Original file line numberDiff line numberDiff line change
@@ -1255,3 +1255,11 @@ Returns `None` if the array is empty.
12551255
```
12561256
*/
12571257
let last: array<'a> => option<'a>
1258+
1259+
/**
1260+
`ignore(array)` ignores the provided array and returns unit.
1261+
1262+
This helper is useful when you want to discard a value (for example, the result of an operation with side effects)
1263+
without having to store or process it further.
1264+
*/
1265+
external ignore: array<'a> => unit = "%ignore"

runtime/Stdlib_AsyncIterator.res

+2
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,5 @@ let make: (unit => promise<value<'value>>) => t<'value> = %raw(`function makeAsy
3535
}
3636
}
3737
}`)
38+
39+
external ignore: t<'a> => unit = "%ignore"

runtime/Stdlib_AsyncIterator.resi

+9
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,12 @@ main()->ignore
186186
```
187187
*/
188188
let forEach: (t<'a>, option<'a> => unit) => promise<unit>
189+
190+
/**
191+
`ignore(iterator)` ignores the provided async iterator and returns unit.
192+
193+
This helper is useful when you want to discard a value (for example, the result of an operation with side effects)
194+
without having to store or process it further.
195+
196+
*/
197+
external ignore: t<'a> => unit = "%ignore"

runtime/Stdlib_BigInt.res

+8
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,11 @@ external lsl: (bigint, bigint) => bigint = "%lslbigint"
9292
external asr: (bigint, bigint) => bigint = "%asrbigint"
9393

9494
let lnot = x => lxor(x, -1n)
95+
96+
/**
97+
`ignore(bigint)` ignores the provided bigint and returns unit.
98+
99+
This helper is useful when you want to discard a value (for example, the result of an operation with side effects)
100+
without having to store or process it further.
101+
*/
102+
external ignore: bigint => unit = "%ignore"

runtime/Stdlib_BigInt64Array.res

+8
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,11 @@ external fromArrayLikeOrIterable: 'a => t = "BigInt64Array.from"
5252
*/
5353
@val
5454
external fromArrayLikeOrIterableWithMap: ('a, ('b, int) => bigint) => t = "BigInt64Array.from"
55+
56+
/**
57+
`ignore(bigIntArray)` ignores the provided bigIntArray and returns unit.
58+
59+
This helper is useful when you want to discard a value (for example, the result of an operation with side effects)
60+
without having to store or process it further.
61+
*/
62+
external ignore: t => unit = "%ignore"

runtime/Stdlib_BigUint64Array.res

+8
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,11 @@ external fromArrayLikeOrIterable: 'a => t = "BigUint64Array.from"
5252
*/
5353
@val
5454
external fromArrayLikeOrIterableWithMap: ('a, ('b, int) => bigint) => t = "BigUint64Array.from"
55+
56+
/**
57+
`ignore(bigUintArray)` ignores the provided bigUintArray and returns unit.
58+
59+
This helper is useful when you want to discard a value (for example, the result of an operation with side effects)
60+
without having to store or process it further.
61+
*/
62+
external ignore: t => unit = "%ignore"

runtime/Stdlib_DataView.res

+8
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,11 @@ external fromBufferWithRange: (Stdlib_ArrayBuffer.t, ~byteOffset: int, ~length:
3535

3636
@send external setBigInt64: (t, int, bigint) => unit = "setBigInt64"
3737
@send external setBigUint64: (t, int, bigint) => unit = "setBigUint64"
38+
39+
/**
40+
`ignore(dataView)` ignores the provided dataView and returns unit.
41+
42+
This helper is useful when you want to discard a value (for example, the result of an operation with side effects)
43+
without having to store or process it further.
44+
*/
45+
external ignore: t => unit = "%ignore"

runtime/Stdlib_Date.res

+2
Original file line numberDiff line numberDiff line change
@@ -178,3 +178,5 @@ external toLocaleTimeStringWithLocaleAndOptions: (t, string, localeOptions) => s
178178
@send external toISOString: t => string = "toISOString"
179179
@send external toUTCString: t => string = "toUTCString"
180180
@return(nullable) @send external toJSON: t => option<string> = "toJSON"
181+
182+
external ignore: t => unit = "%ignore"

runtime/Stdlib_Date.resi

+8
Original file line numberDiff line numberDiff line change
@@ -1358,3 +1358,11 @@ Date.fromString("")->Date.toJSON
13581358
@return(nullable)
13591359
@send
13601360
external toJSON: t => option<string> = "toJSON"
1361+
1362+
/**
1363+
`ignore(date)` ignores the provided date and returns unit.
1364+
1365+
This helper is useful when you want to discard a value (for example, the result of an operation with side effects)
1366+
without having to store or process it further.
1367+
*/
1368+
external ignore: t => unit = "%ignore"

runtime/Stdlib_Dict.res

+2
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,5 @@ let mapValues = (dict, f) => {
4242
}
4343

4444
let has: (dict<'a>, string) => bool = %raw(`(dict, key) => key in dict`)
45+
46+
external ignore: dict<'a> => unit = "%ignore"

runtime/Stdlib_Dict.resi

+8
Original file line numberDiff line numberDiff line change
@@ -257,3 +257,11 @@ dict->Dict.has("key3") // false
257257
```
258258
*/
259259
let has: (dict<'a>, string) => bool
260+
261+
/**
262+
`ignore(dict)` ignores the provided dict and returns unit.
263+
264+
This helper is useful when you want to discard a value (for example, the result of an operation with side effects)
265+
without having to store or process it further.
266+
*/
267+
external ignore: dict<'a> => unit = "%ignore"

runtime/Stdlib_Error.res

+2
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,5 @@ module URIError = {
4141
external raise: t => 'a = "%raise"
4242

4343
let panic = msg => make(`Panic! ${msg}`)->raise
44+
45+
external ignore: t => unit = "%ignore"

runtime/Stdlib_Error.resi

+8
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,11 @@ try {
180180
```
181181
*/
182182
let panic: string => 'a
183+
184+
/**
185+
`ignore(error)` ignores the provided error and returns unit.
186+
187+
This helper is useful when you want to discard a value (for example, the result of an operation with side effects)
188+
without having to store or process it further.
189+
*/
190+
external ignore: t => unit = "%ignore"

runtime/Stdlib_Exn.res

+2
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,5 @@ exception TypeError of error
8888
The URIError object represents an error when a global URI handling function was used in a wrong way.
8989
exception URIError of error
9090
*/
91+
92+
external ignore: t => unit = "%ignore"

runtime/Stdlib_Exn.resi

+8
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,11 @@ let raiseReferenceError: string => 'a
5959
let raiseSyntaxError: string => 'a
6060
let raiseTypeError: string => 'a
6161
let raiseUriError: string => 'a
62+
63+
/**
64+
`ignore(exn)` ignores the provided exn and returns unit.
65+
66+
This helper is useful when you want to discard a value (for example, the result of an operation with side effects)
67+
without having to store or process it further.
68+
*/
69+
external ignore: t => unit = "%ignore"

runtime/Stdlib_Float.res

+2
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,5 @@ let clamp = (~min=?, ~max=?, value): float => {
5959
| _ => value
6060
}
6161
}
62+
63+
external ignore: float => unit = "%ignore"

runtime/Stdlib_Float.resi

+8
Original file line numberDiff line numberDiff line change
@@ -462,3 +462,11 @@ Float.clamp(4.2, ~min=4.3, ~max=4.1) == 4.3
462462
```
463463
*/
464464
let clamp: (~min: float=?, ~max: float=?, float) => float
465+
466+
/**
467+
`ignore(float)` ignores the provided float and returns unit.
468+
469+
This helper is useful when you want to discard a value (for example, the result of an operation with side effects)
470+
without having to store or process it further.
471+
*/
472+
external ignore: float => unit = "%ignore"

runtime/Stdlib_Float32Array.res

+8
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,11 @@ external fromArrayLikeOrIterable: 'a => t = "Float32Array.from"
5252
*/
5353
@val
5454
external fromArrayLikeOrIterableWithMap: ('a, ('b, int) => float) => t = "Float32Array.from"
55+
56+
/**
57+
`ignore(floatArray)` ignores the provided floatArray and returns unit.
58+
59+
This helper is useful when you want to discard a value (for example, the result of an operation with side effects)
60+
without having to store or process it further.
61+
*/
62+
external ignore: t => unit = "%ignore"

runtime/Stdlib_Float64Array.res

+8
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,11 @@ external fromArrayLikeOrIterable: 'a => t = "Float64Array.from"
5252
*/
5353
@val
5454
external fromArrayLikeOrIterableWithMap: ('a, ('b, int) => float) => t = "Float64Array.from"
55+
56+
/**
57+
`ignore(floatArray)` ignores the provided floatArray and returns unit.
58+
59+
This helper is useful when you want to discard a value (for example, the result of an operation with side effects)
60+
without having to store or process it further.
61+
*/
62+
external ignore: t => unit = "%ignore"

runtime/Stdlib_Global.res

+8
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,11 @@ type intervalId
1515

1616
@val external encodeURIComponent: string => string = "encodeURIComponent"
1717
@val external decodeURIComponent: string => string = "decodeURIComponent"
18+
19+
module TimeoutId = {
20+
external ignore: timeoutId => unit = "%ignore"
21+
}
22+
23+
module IntervalId = {
24+
external ignore: intervalId => unit = "%ignore"
25+
}

runtime/Stdlib_Global.resi

+20
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,23 @@ Console.log(decodeURIComponent("array%3D%5BsomeValue%5D"))
199199
*/
200200
@val
201201
external decodeURIComponent: string => string = "decodeURIComponent"
202+
203+
module TimeoutId: {
204+
/**
205+
`ignore(timeoutId)` ignores the provided timeoutId and returns unit.
206+
207+
This helper is useful when you want to discard a value (for example, the result of an operation with side effects)
208+
without having to store or process it further.
209+
*/
210+
external ignore: timeoutId => unit = "%ignore"
211+
}
212+
213+
module IntervalId: {
214+
/**
215+
`ignore(intervalId)` ignores the provided intervalId and returns unit.
216+
217+
This helper is useful when you want to discard a value (for example, the result of an operation with side effects)
218+
without having to store or process it further.
219+
*/
220+
external ignore: intervalId => unit = "%ignore"
221+
}

runtime/Stdlib_Int.res

+2
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,5 @@ module Bitwise = {
106106

107107
let lnot = x => lxor(x, -1)
108108
}
109+
110+
external ignore: int => unit = "%ignore"

runtime/Stdlib_Int.resi

+8
Original file line numberDiff line numberDiff line change
@@ -471,3 +471,11 @@ module Bitwise: {
471471
*/
472472
external asr: (int, int) => int = "%asrint"
473473
}
474+
475+
/**
476+
`ignore(int)` ignores the provided int and returns unit.
477+
478+
This helper is useful when you want to discard a value (for example, the result of an operation with side effects)
479+
without having to store or process it further.
480+
*/
481+
external ignore: int => unit = "%ignore"

runtime/Stdlib_Int16Array.res

+8
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,11 @@ external fromArrayLikeOrIterable: 'a => t = "Int16Array.from"
5252
*/
5353
@val
5454
external fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t = "Int16Array.from"
55+
56+
/**
57+
`ignore(intArray)` ignores the provided intArray and returns unit.
58+
59+
This helper is useful when you want to discard a value (for example, the result of an operation with side effects)
60+
without having to store or process it further.
61+
*/
62+
external ignore: t => unit = "%ignore"

runtime/Stdlib_Int32Array.res

+8
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,11 @@ external fromArrayLikeOrIterable: 'a => t = "Int32Array.from"
5252
*/
5353
@val
5454
external fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t = "Int32Array.from"
55+
56+
/**
57+
`ignore(intArray)` ignores the provided intArray and returns unit.
58+
59+
This helper is useful when you want to discard a value (for example, the result of an operation with side effects)
60+
without having to store or process it further.
61+
*/
62+
external ignore: t => unit = "%ignore"

runtime/Stdlib_Int8Array.res

+8
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,11 @@ external fromArrayLikeOrIterable: 'a => t = "Int8Array.from"
5252
*/
5353
@val
5454
external fromArrayLikeOrIterableWithMap: ('a, ('b, int) => int) => t = "Int8Array.from"
55+
56+
/**
57+
`ignore(intArray)` ignores the provided intArray and returns unit.
58+
59+
This helper is useful when you want to discard a value (for example, the result of an operation with side effects)
60+
without having to store or process it further.
61+
*/
62+
external ignore: t => unit = "%ignore"

runtime/Stdlib_Intl_Collator.res

+8
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,11 @@ external supportedLocalesOf: (array<string>, ~options: supportedLocalesOptions=?
3434
@send external resolvedOptions: t => resolvedOptions = "resolvedOptions"
3535

3636
@send external compare: (t, string, string) => int = "compare"
37+
38+
/**
39+
`ignore(collator)` ignores the provided collator and returns unit.
40+
41+
This helper is useful when you want to discard a value (for example, the result of an operation with side effects)
42+
without having to store or process it further.
43+
*/
44+
external ignore: t => unit = "%ignore"

runtime/Stdlib_Intl_DateTimeFormat.res

+8
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,11 @@ external formatRangeToParts: (
127127
~startDate: Stdlib_Date.t,
128128
~endDate: Stdlib_Date.t,
129129
) => array<dateTimeRangePart> = "formatRangeToParts"
130+
131+
/**
132+
`ignore(dateTimeFormat)` ignores the provided dateTimeFormat and returns unit.
133+
134+
This helper is useful when you want to discard a value (for example, the result of an operation with side effects)
135+
without having to store or process it further.
136+
*/
137+
external ignore: t => unit = "%ignore"

0 commit comments

Comments
 (0)