Skip to content

Commit 7c30e7b

Browse files
committed
Test examples: use compiler 10 beta.
1 parent 9bf0c69 commit 7c30e7b

File tree

9 files changed

+69
-44
lines changed

9 files changed

+69
-44
lines changed

analysis/tests/package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

analysis/tests/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
"@rescript/react": "^0.10.3"
99
},
1010
"dependencies": {
11-
"rescript": "^9.1.4"
11+
"rescript": "^10.0.0-beta.1"
1212
}
1313
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Hover src/Auto.res 2:13
2-
{"contents": "```rescript\n(Belt.List.t<'a>, 'a => 'b) => Belt.List.t<'b>\n```\n\n\n `map xs f`\n\n **return** the list obtained by applying `f` to each element of `xs`\n\n ```\n map [1;2] (fun x-> x + 1) = [3;4]\n ```\n"}
2+
{"contents": "```rescript\n(Belt.List.t<'a>, 'a => 'b) => Belt.List.t<'b>\n```\n\n\n Returns a new list with `f` applied to each element of `someList`.\n\n ```res example\n list{1, 2}->Belt.List.map(x => x + 1) // list{3, 4}\n ```\n"}
33

analysis/tests/src/expected/Completion.res.txt

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,67 +7,67 @@ Completable: Cpath Value[MyList, m]
77
"kind": 12,
88
"tags": [],
99
"detail": "(t<'a>, 'a => 'b) => t<'b>",
10-
"documentation": {"kind": "markdown", "value": "\n `mapReverse xs f`\n\n Equivalent to `reverse (map xs f)`\n\n ```\n mapReverse [3;4;5] (fun x -> x * x) = [25;16;9];;\n ```\n"}
10+
"documentation": {"kind": "markdown", "value": "\n Equivalent to:\n\n ```res\n map(someList, f)->reverse\n ```\n\n ```res example\n list{3, 4, 5}->Belt.List.mapReverse(x => x * x) /* list{25, 16, 9} */\n ```\n"}
1111
}, {
1212
"label": "makeBy",
1313
"kind": 12,
1414
"tags": [],
1515
"detail": "(int, int => 'a) => t<'a>",
16-
"documentation": {"kind": "markdown", "value": "\n `makeBy n f`\n\n **return** a list of length `n` with element `i` initialized with `f i`\n\n **return** the empty list if `n` is negative\n\n ```\n makeBy 5 (fun i -> i) = [0;1;2;3;4];;\n makeBy 5 (fun i -> i * i) = [0;1;4;9;16];;\n ```\n"}
16+
"documentation": {"kind": "markdown", "value": "\nReturn a list of length `numItems` with element `i` initialized with `f(i)`.\nReturns an empty list if `numItems` is negative.\n\n```res example\nBelt.List.makeBy(5, i => i) // list{0, 1, 2, 3, 4}\n\nBelt.List.makeBy(5, i => i * i) // list{0, 1, 4, 9, 16}\n```\n"}
1717
}, {
1818
"label": "make",
1919
"kind": 12,
2020
"tags": [],
2121
"detail": "(int, 'a) => t<'a>",
22-
"documentation": {"kind": "markdown", "value": "\n `make n v`\n\n **return** a list of length `n` with each element filled with value `v`\n\n **return** the empty list if `n` is negative\n\n ```\n make 3 1 = [1;1;1]\n ```\n"}
22+
"documentation": {"kind": "markdown", "value": "\n Returns a list of length `numItems` with each element filled with value `v`. Returns an empty list if `numItems` is negative.\n\n ```res example\n Belt.List.make(3, 1) // list{1, 1, 1}\n ```\n"}
2323
}, {
2424
"label": "mapReverse2U",
2525
"kind": 12,
2626
"tags": [],
2727
"detail": "(t<'a>, t<'b>, (. 'a, 'b) => 'c) => t<'c>",
28-
"documentation": null
28+
"documentation": {"kind": "markdown", "value": " Uncurried version of [mapReverse2](#mapReverse2). "}
2929
}, {
3030
"label": "map",
3131
"kind": 12,
3232
"tags": [],
3333
"detail": "(t<'a>, 'a => 'b) => t<'b>",
34-
"documentation": {"kind": "markdown", "value": "\n `map xs f`\n\n **return** the list obtained by applying `f` to each element of `xs`\n\n ```\n map [1;2] (fun x-> x + 1) = [3;4]\n ```\n"}
34+
"documentation": {"kind": "markdown", "value": "\n Returns a new list with `f` applied to each element of `someList`.\n\n ```res example\n list{1, 2}->Belt.List.map(x => x + 1) // list{3, 4}\n ```\n"}
3535
}, {
3636
"label": "mapWithIndexU",
3737
"kind": 12,
3838
"tags": [],
3939
"detail": "(t<'a>, (. int, 'a) => 'b) => t<'b>",
40-
"documentation": null
40+
"documentation": {"kind": "markdown", "value": " Uncurried version of [mapWithIndex](#mapWithIndex). "}
4141
}, {
4242
"label": "mapU",
4343
"kind": 12,
4444
"tags": [],
4545
"detail": "(t<'a>, (. 'a) => 'b) => t<'b>",
46-
"documentation": null
46+
"documentation": {"kind": "markdown", "value": " Uncurried version of [map](#map). "}
4747
}, {
4848
"label": "makeByU",
4949
"kind": 12,
5050
"tags": [],
5151
"detail": "(int, (. int) => 'a) => t<'a>",
52-
"documentation": null
52+
"documentation": {"kind": "markdown", "value": " Uncurried version of [makeBy](#makeBy) "}
5353
}, {
5454
"label": "mapReverse2",
5555
"kind": 12,
5656
"tags": [],
5757
"detail": "(t<'a>, t<'b>, ('a, 'b) => 'c) => t<'c>",
58-
"documentation": {"kind": "markdown", "value": "\n `mapReverse2 xs ys f`\n\n equivalent to `reverse (zipBy xs ys f)`\n\n ```\n mapReverse2 [1;2;3] [1;2] (+) = [4;2]\n ```\n"}
58+
"documentation": {"kind": "markdown", "value": "\n Equivalent to: `zipBy(xs, ys, f)->reverse`\n\n ```res example\n\n Belt.List.mapReverse2(list{1, 2, 3}, list{1, 2}, (a, b) => a + b) // list{4, 2}\n ```\n"}
5959
}, {
6060
"label": "mapWithIndex",
6161
"kind": 12,
6262
"tags": [],
6363
"detail": "(t<'a>, (int, 'a) => 'b) => t<'b>",
64-
"documentation": {"kind": "markdown", "value": "\n `mapWithIndex xs f` applies `f` to each element of `xs`. Function `f` takes two arguments:\n the index starting from 0 and the element from `xs`.\n\n ```\n mapWithIndex [1;2;3] (fun i x -> i + x) =\n [0 + 1; 1 + 2; 2 + 3 ]\n ```\n"}
64+
"documentation": {"kind": "markdown", "value": "\n Applies `f` to each element of `someList`.\n Function `f` takes two arguments: the index starting from 0 and the element from `someList`, in that order.\n\n ```res example\n list{1, 2, 3}->Belt.List.mapWithIndex((index, x) => index + x) // list{1, 3, 5}\n ```\n"}
6565
}, {
6666
"label": "mapReverseU",
6767
"kind": 12,
6868
"tags": [],
6969
"detail": "(t<'a>, (. 'a) => 'b) => t<'b>",
70-
"documentation": null
70+
"documentation": {"kind": "markdown", "value": " Uncurried version of [mapReverse](#mapReverse). "}
7171
}]
7272

7373
Complete src/Completion.res 3:9
@@ -385,13 +385,13 @@ Completable: Cpath array->m
385385
"kind": 12,
386386
"tags": [],
387387
"detail": "(t<'a>, ('a, int) => 'b) => t<'b>",
388-
"documentation": null
388+
"documentation": {"kind": "markdown", "value": "\nApplies the function (the second argument) to each item in the array, returning\na new array. The function acceps two arguments: an item from the array and its\nindex number. The result array does not have to have elements of the same type\nas the input array. See\n[`Array.map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)\non MDN.\n\n```res example\n// multiply each item in array by its position\nlet product = (item, index) => item * index\nJs.Array2.mapi([10, 11, 12], product) == [0, 11, 24]\n```\n"}
389389
}, {
390390
"label": "Js.Array2.map",
391391
"kind": 12,
392392
"tags": [],
393393
"detail": "(t<'a>, 'a => 'b) => t<'b>",
394-
"documentation": null
394+
"documentation": {"kind": "markdown", "value": "\nApplies the function (the second argument) to each item in the array, returning\na new array. The result array does not have to have elements of the same type\nas the input array. See\n[`Array.map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)\non MDN.\n\n```res example\nJs.Array2.map([12, 4, 8], x => x * x) == [144, 16, 64]\nJs.Array2.map([\"animal\", \"vegetable\", \"mineral\"], Js.String.length) == [6, 9, 7]\n```\n"}
395395
}]
396396

397397
Complete src/Completion.res 29:13
@@ -402,7 +402,7 @@ Completable: Cpath string->toU
402402
"kind": 12,
403403
"tags": [],
404404
"detail": "t => t",
405-
"documentation": {"kind": "markdown", "value": "\n `toUpperCase str` converts `str` to upper case using the locale-insensitive case mappings in the Unicode Character Database. Notice that the conversion can expand the number of letters in the result; for example the German `ß` capitalizes to two `S`es in a row.\n\n ```\n toUpperCase \"abc\" = \"ABC\";;\n toUpperCase {js|Straße|js} = {js|STRASSE|js};;\n toLowerCase {js|πς|js} = {js|ΠΣ|js};;\n ```\n"}
405+
"documentation": {"kind": "markdown", "value": "\n`toUpperCase(str)` converts `str` to upper case using the locale-insensitive\ncase mappings in the Unicode Character Database. Notice that the conversion can\nexpand the number of letters in the result; for example the German ß\ncapitalizes to two Ses in a row.\n\nSee [`String.toUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase)\non MDN.\n\n```res example\nJs.String2.toUpperCase(\"abc\") == \"ABC\"\nJs.String2.toUpperCase(`Straße`) == `STRASSE`\nJs.String2.toUpperCase(`πς`) == `ΠΣ`\n```\n"}
406406
}]
407407

408408
Complete src/Completion.res 34:8
@@ -419,7 +419,7 @@ Completable: Cpath Value[op]->e
419419
"kind": 12,
420420
"tags": [],
421421
"detail": "(option<'a>, option<'b>, ('a, 'b) => bool) => bool",
422-
"documentation": {"kind": "markdown", "value": "\n `eq optValue1 optvalue2 predicate`\n\n Evaluates two optional values for equality with respect to a predicate function.\n\n If both `optValue1` and `optValue2` are `None`, returns `true`.\n\n If one of the arguments is `Some value` and the other is `None`, returns `false`\n\n If arguments are `Some value1` and `Some value2`, returns the result of `predicate value1 value2`;\n the `predicate` function must return a `bool`\n\n ```\n let clockEqual = (fun a b -> a mod 12 = b mod 12);;\n eq (Some 3) (Some 15) clockEqual = true;;\n eq (Some 3) None clockEqual = false;;\n eq None (Some 3) clockEqual = false;;\n eq None None clockEqual = true;;\n ```\n"}
422+
"documentation": {"kind": "markdown", "value": "\n Evaluates two optional values for equality with respect to a predicate\n function. If both `optValue1` and `optValue2` are `None`, returns `true`.\n If one of the arguments is `Some(value)` and the other is `None`, returns\n `false`.\n\n If arguments are `Some(value1)` and `Some(value2)`, returns the result of\n `predicate(value1, value2)`; the predicate function must return a bool.\n\n ```res example\n let clockEqual = (a, b) => mod(a, 12) == mod(b, 12)\n\n open Belt.Option\n\n eq(Some(3), Some(15), clockEqual) /* true */\n\n eq(Some(3), None, clockEqual) /* false */\n\n eq(None, Some(3), clockEqual) /* false */\n\n eq(None, None, clockEqual) /* true */\n ```\n"}
423423
}]
424424

425425
Complete src/Completion.res 44:7
@@ -451,7 +451,7 @@ Completable: Cpath Value[Js, Dict, u]
451451
"kind": 12,
452452
"tags": [],
453453
"detail": "(t<'a>, key) => 'a",
454-
"documentation": {"kind": "markdown", "value": "\n `unsafeGet dict key` return the value if the `key` exists,\n otherwise an **undefined** value is returned. Must be used only\n when the existence of a key is certain. (i.e. when having called `keys`\n function previously.\n\n ```\n Array.iter (fun key -> Js.log (Js_dict.unsafeGet dic key)) (Js_dict.keys dict)\n ```\n"}
454+
"documentation": {"kind": "markdown", "value": "\n`Js.Dict.unsafeGet(key)` returns the value if the key exists, otherwise an `undefined` value is returned. Use this only when you are sure the key exists (i.e. when having used the `keys()` function to check that the key is valid).\n\n```res example\nJs.Dict.unsafeGet(ages, \"Fred\") == 49\nJs.Dict.unsafeGet(ages, \"Paul\") // returns undefined\n```\n"}
455455
}, {
456456
"label": "unsafeDeleteKey",
457457
"kind": 12,
@@ -771,13 +771,13 @@ Completable: Cpath Type[Js, n]
771771
"kind": 22,
772772
"tags": [],
773773
"detail": "type nullable<+'a>",
774-
"documentation": {"kind": "markdown", "value": " value of this type can be [undefined], [null] or ['a]\n this type is the same as type [t] n {!Null_undefined} "}
774+
"documentation": {"kind": "markdown", "value": "\n A value of this type can be undefined, null or 'a. This type is equivalent to Js.Null_undefined.t.\n"}
775775
}, {
776776
"label": "null",
777777
"kind": 22,
778778
"tags": [],
779779
"detail": "type null<+'a>",
780-
"documentation": {"kind": "markdown", "value": " nullable, value of this type can be either [null] or ['a]\n this type is the same as type [t] in {!Null}\n"}
780+
"documentation": {"kind": "markdown", "value": "\n Nullable value of this type can be either null or 'a. This type is equivalent to Js.Null.t.\n"}
781781
}]
782782

783783
Complete src/Completion.res 174:20
@@ -813,12 +813,6 @@ Completable: Cpath Module[For]
813813
"tags": [],
814814
"detail": "module",
815815
"documentation": null
816-
}, {
817-
"label": "Format",
818-
"kind": 9,
819-
"tags": [],
820-
"detail": "file module",
821-
"documentation": null
822816
}]
823817

824818
Complete src/Completion.res 190:11
@@ -1509,13 +1503,13 @@ Completable: Cpath array->ma
15091503
"kind": 12,
15101504
"tags": [],
15111505
"detail": "(t<'a>, ('a, int) => 'b) => t<'b>",
1512-
"documentation": null
1506+
"documentation": {"kind": "markdown", "value": "\nApplies the function (the second argument) to each item in the array, returning\na new array. The function acceps two arguments: an item from the array and its\nindex number. The result array does not have to have elements of the same type\nas the input array. See\n[`Array.map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)\non MDN.\n\n```res example\n// multiply each item in array by its position\nlet product = (item, index) => item * index\nJs.Array2.mapi([10, 11, 12], product) == [0, 11, 24]\n```\n"}
15131507
}, {
15141508
"label": "Array2.map",
15151509
"kind": 12,
15161510
"tags": [],
15171511
"detail": "(t<'a>, 'a => 'b) => t<'b>",
1518-
"documentation": null
1512+
"documentation": {"kind": "markdown", "value": "\nApplies the function (the second argument) to each item in the array, returning\na new array. The result array does not have to have elements of the same type\nas the input array. See\n[`Array.map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)\non MDN.\n\n```res example\nJs.Array2.map([12, 4, 8], x => x * x) == [144, 16, 64]\nJs.Array2.map([\"animal\", \"vegetable\", \"mineral\"], Js.String.length) == [6, 9, 7]\n```\n"}
15191513
}]
15201514

15211515
Complete src/Completion.res 397:14

analysis/tests/src/expected/Debug.res.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ resolvePath path:map
4949
[ref] Got stamp 1024
5050
[ref] alternateDeclared for Belt_List not found
5151
[ref] Inner uri belt_List.mli
52-
{"uri": "belt_List.mli", "range": {"start": {"line": 239, "character": 4}, "end": {"line": 239, "character": 7}}}
52+
{"uri": "belt_List.mli", "range": {"start": {"line": 245, "character": 4}, "end": {"line": 245, "character": 7}}}
5353

5454
Definition src/Debug.res 4:14
5555
locItems:

analysis/tests/src/expected/Definition.res.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Hover src/Definition.res 14:14
88
{"contents": "```rescript\n('a => 'b, list<'a>) => list<'b>\n```\n\n [List.map f [a1; ...; an]] applies function [f] to [a1, ..., an],\n and builds the list [[f a1; ...; f an]]\n with the results returned by [f]. Not tail-recursive. "}
99

1010
Hover src/Definition.res 18:14
11-
{"contents": "```rescript\n(Belt.List.t<'a>, 'a => 'b) => Belt.List.t<'b>\n```\n\n\n `map xs f`\n\n **return** the list obtained by applying `f` to each element of `xs`\n\n ```\n map [1;2] (fun x-> x + 1) = [3;4]\n ```\n"}
11+
{"contents": "```rescript\n(Belt.List.t<'a>, 'a => 'b) => Belt.List.t<'b>\n```\n\n\n Returns a new list with `f` applied to each element of `someList`.\n\n ```res example\n list{1, 2}->Belt.List.map(x => x + 1) // list{3, 4}\n ```\n"}
1212

1313
Hover src/Definition.res 23:3
1414
{"contents": "```rescript\n(. int, int) => int\n```"}

analysis/tests/src/expected/Fragment.res.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,13 @@ the type is not great but jump to definition works
44
{"contents": "```rescript\nReact.component<{\"children\": React.element}>\n```\n\n```rescript\ntype component<'props> = componentLike<'props, element>\n```"}
55

66
Hover src/Fragment.res 9:56
7-
{"contents": "```rescript\n(\n string,\n ~props: ReactDOMRe.props=?,\n array<React.element>,\n) => React.element\n```"}
7+
Nothing at that position. Now trying to use completion.
8+
posCursor:[9:56] posNoWhite:[9:55] Found expr:[9:10->9:67]
9+
Pexp_construct :::[9:13->9:67] [9:13->9:67]
10+
posCursor:[9:56] posNoWhite:[9:55] Found expr:[9:13->9:67]
11+
posCursor:[9:56] posNoWhite:[9:55] Found expr:[9:13->9:66]
12+
JSX <SectionHeader:[9:13->9:26] > _children:9:26
13+
posCursor:[9:56] posNoWhite:[9:55] Found expr:__ghost__[9:10->9:67]
14+
Pexp_construct []:__ghost__[9:10->9:67] None
15+
null
816

analysis/tests/src/expected/Jsx.res.txt

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ Completable: Cpath Module[M]
4545
"tags": [],
4646
"detail": "file module",
4747
"documentation": null
48+
}, {
49+
"label": "MapLabels",
50+
"kind": 9,
51+
"tags": [],
52+
"detail": "file module",
53+
"documentation": null
4854
}, {
4955
"label": "MoreLabels",
5056
"kind": 9,
@@ -403,8 +409,25 @@ Completable: Cpath Module[Nested, ""]
403409
}]
404410

405411
Hover src/Jsx.res 162:12
406-
{"contents": "```rescript\n(\n string,\n ~props: ReactDOMRe.props=?,\n array<React.element>,\n) => React.element\n```"}
412+
Nothing at that position. Now trying to use completion.
413+
posCursor:[162:12] posNoWhite:[162:11] Found expr:[162:3->162:21]
414+
Pexp_construct :::[162:6->162:21] [162:6->162:21]
415+
posCursor:[162:12] posNoWhite:[162:11] Found expr:[162:6->162:21]
416+
posCursor:[162:12] posNoWhite:[162:11] Found expr:[162:6->162:20]
417+
JSX <Comp:[162:6->162:10] age[162:11->162:14]=...[162:15->162:17]> _children:162:18
418+
Completable: Cjsx([Comp], age, [age])
419+
{"contents": "```rescript\nint\n```"}
407420

408421
Hover src/Jsx.res 167:16
409-
{"contents": "```rescript\n(\n string,\n ~props: ReactDOMRe.props=?,\n array<React.element>,\n) => React.element\n```"}
422+
Nothing at that position. Now trying to use completion.
423+
posCursor:[167:16] posNoWhite:[167:15] Found expr:[167:3->167:30]
424+
Pexp_construct :::[167:7->167:30] [167:7->167:30]
425+
posCursor:[167:16] posNoWhite:[167:15] Found expr:[167:7->167:30]
426+
posCursor:[167:16] posNoWhite:[167:15] Found expr:[167:7->167:25]
427+
Pexp_construct :::[167:10->167:25] [167:10->167:25]
428+
posCursor:[167:16] posNoWhite:[167:15] Found expr:[167:10->167:25]
429+
posCursor:[167:16] posNoWhite:[167:15] Found expr:[167:10->167:24]
430+
JSX <Comp:[167:10->167:14] age[167:15->167:18]=...[167:19->167:21]> _children:167:22
431+
Completable: Cjsx([Comp], age, [age])
432+
{"contents": "```rescript\nint\n```"}
410433

0 commit comments

Comments
 (0)