diff --git a/analysis/Makefile b/analysis/Makefile index e978febc3..8d3d4a6d6 100644 --- a/analysis/Makefile +++ b/analysis/Makefile @@ -32,11 +32,11 @@ build-native: $(OUTPUT) depend dce: build-native ../node_modules/.bin/reanalyze -dce-cmt src -suppress src/vendor -tests/node_modules/.bin/rescript: +tests/node_modules/.bin/bsb: @cd tests && npm install -test: dce tests/node_modules/.bin/rescript - @cd tests && node_modules/.bin/rescript +test: dce tests/node_modules/.bin/bsb + @cd tests && node_modules/.bin/bsb -make-world ./test.sh clean: diff --git a/analysis/tests/package-lock.json b/analysis/tests/package-lock.json index 604e88e0f..f1d63341d 100644 --- a/analysis/tests/package-lock.json +++ b/analysis/tests/package-lock.json @@ -5,7 +5,7 @@ "packages": { "": { "dependencies": { - "rescript": "9.1.2" + "bs-platform": "^9.0.2" }, "devDependencies": { "@rescript/react": "^0.10.2" @@ -26,9 +26,7 @@ "version": "9.0.2", "resolved": "https://registry.npmjs.org/bs-platform/-/bs-platform-9.0.2.tgz", "integrity": "sha512-Ye9JqJ4Oa7mcjjoOVRYI8Uc2Cf8N7jQLWDcdUplY7996d/YErSR7WitmV7XnSwr4EvdrbwjEsg1NxNjUQv3ChA==", - "dev": true, "hasInstallScript": true, - "peer": true, "bin": { "bsb": "bsb", "bsc": "bsc", @@ -95,18 +93,6 @@ "react": "17.0.2" } }, - "node_modules/rescript": { - "version": "9.1.2", - "resolved": "https://registry.npmjs.org/rescript/-/rescript-9.1.2.tgz", - "integrity": "sha512-4wHvTDv3nyYnAPJHcg1RGG8z7u3HDiBf6RN3P/dITDv859Qo35aKOzJWQtfBzbAs0EKNafLqei3TnUqiAv6BwQ==", - "hasInstallScript": true, - "bin": { - "bsc": "bsc", - "bsrefmt": "bsrefmt", - "bstracing": "lib/bstracing", - "rescript": "rescript" - } - }, "node_modules/scheduler": { "version": "0.20.2", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.20.2.tgz", @@ -130,9 +116,7 @@ "bs-platform": { "version": "9.0.2", "resolved": "https://registry.npmjs.org/bs-platform/-/bs-platform-9.0.2.tgz", - "integrity": "sha512-Ye9JqJ4Oa7mcjjoOVRYI8Uc2Cf8N7jQLWDcdUplY7996d/YErSR7WitmV7XnSwr4EvdrbwjEsg1NxNjUQv3ChA==", - "dev": true, - "peer": true + "integrity": "sha512-Ye9JqJ4Oa7mcjjoOVRYI8Uc2Cf8N7jQLWDcdUplY7996d/YErSR7WitmV7XnSwr4EvdrbwjEsg1NxNjUQv3ChA==" }, "js-tokens": { "version": "4.0.0", @@ -181,11 +165,6 @@ "scheduler": "^0.20.2" } }, - "rescript": { - "version": "9.1.2", - "resolved": "https://registry.npmjs.org/rescript/-/rescript-9.1.2.tgz", - "integrity": "sha512-4wHvTDv3nyYnAPJHcg1RGG8z7u3HDiBf6RN3P/dITDv859Qo35aKOzJWQtfBzbAs0EKNafLqei3TnUqiAv6BwQ==" - }, "scheduler": { "version": "0.20.2", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.20.2.tgz", diff --git a/analysis/tests/package.json b/analysis/tests/package.json index 494c552bc..283d2d8eb 100644 --- a/analysis/tests/package.json +++ b/analysis/tests/package.json @@ -1,9 +1,9 @@ { "scripts": {}, - "dependencies": { - "rescript": "9.1.2" - }, "devDependencies": { "@rescript/react": "^0.10.2" + }, + "dependencies": { + "bs-platform": "^9.0.2" } } diff --git a/analysis/tests/src/expected/Auto.res.txt b/analysis/tests/src/expected/Auto.res.txt index f82058d6b..5eef88665 100644 --- a/analysis/tests/src/expected/Auto.res.txt +++ b/analysis/tests/src/expected/Auto.res.txt @@ -1,3 +1,3 @@ Hover tests/src/Auto.res 2:13 -{"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"} +{"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 @example {[\n map [1;2] (fun x-> x + 1) = [3;4]\n ]}\n"} diff --git a/analysis/tests/src/expected/Completion.res.txt b/analysis/tests/src/expected/Completion.res.txt index dd3c1bd8c..7cfaba418 100644 --- a/analysis/tests/src/expected/Completion.res.txt +++ b/analysis/tests/src/expected/Completion.res.txt @@ -4,19 +4,19 @@ Complete tests/src/Completion.res 0:2 "kind": 12, "tags": [], "detail": "(t<'a>, 'a => 'b) => t<'b>", - "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"} + "documentation": {"kind": "markdown", "value": " [mapReverse xs f]\n\n Equivalent to [reverse (map xs f)]\n \n @example {[\n mapReverse [3;4;5] (fun x -> x * x) = [25;16;9];;\n ]}\n"} }, { "label": "makeBy", "kind": 12, "tags": [], "detail": "(int, int => 'a) => t<'a>", - "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"} + "documentation": {"kind": "markdown", "value": " [makeBy n f] \n \n - return a list of length [n] with element [i] initialized with [f i]\n - return the empty list if [n] is negative\n\n @example {[\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"} }, { "label": "make", "kind": 12, "tags": [], "detail": "(int, 'a) => t<'a>", - "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"} + "documentation": {"kind": "markdown", "value": " [make n v] \n \n - return a list of length [n] with each element filled with value [v] \n - return the empty list if [n] is negative\n\n @example {[\n make 3 1 = [1;1;1]\n ]}\n"} }, { "label": "mapReverse2U", "kind": 12, @@ -28,7 +28,7 @@ Complete tests/src/Completion.res 0:2 "kind": 12, "tags": [], "detail": "(t<'a>, 'a => 'b) => t<'b>", - "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"} + "documentation": {"kind": "markdown", "value": "\n [map xs f]\n\n return the list obtained by applying [f] to each element of [xs]\n\n @example {[\n map [1;2] (fun x-> x + 1) = [3;4]\n ]}\n"} }, { "label": "mapWithIndexU", "kind": 12, @@ -52,13 +52,13 @@ Complete tests/src/Completion.res 0:2 "kind": 12, "tags": [], "detail": "(t<'a>, t<'b>, ('a, 'b) => 'c) => t<'c>", - "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"} + "documentation": {"kind": "markdown", "value": " [mapReverse2 xs ys f]\n\n equivalent to [reverse (zipBy xs ys f)] \n\n @example {[\n mapReverse2 [1;2;3] [1;2] (+) = [4;2]\n ]}\n"} }, { "label": "mapWithIndex", "kind": 12, "tags": [], "detail": "(t<'a>, (int, 'a) => 'b) => t<'b>", - "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"} + "documentation": {"kind": "markdown", "value": " [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 @example {[\n mapWithIndex [1;2;3] (fun i x -> i + x) =\n [0 + 1; 1 + 2; 2 + 3 ]\n ]}\n"} }, { "label": "mapReverseU", "kind": 12, @@ -382,7 +382,7 @@ Complete tests/src/Completion.res 23:2 "kind": 12, "tags": [], "detail": "t => t", - "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"} + "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@example {[\n toUpperCase \"abc\" = \"ABC\";;\n toUpperCase {js|Straße|js} = {js|STRASSE|js};;\n toLowerCase {js|πς|js} = {js|ΠΣ|js};;\n]}\n"} }] Complete tests/src/Completion.res 27:2 @@ -391,13 +391,13 @@ Complete tests/src/Completion.res 27:2 "kind": 12, "tags": [], "detail": "(option<'a>, option<'b>, (. 'a, 'b) => bool) => bool", - "documentation": {"kind": "markdown", "value": "\n Uncurried version of `eq`\n"} + "documentation": {"kind": "markdown", "value": "\n Uncurried version of [eq]\n"} }, { "label": "Belt.Option.eq", "kind": 12, "tags": [], "detail": "(option<'a>, option<'b>, ('a, 'b) => bool) => bool", - "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"} + "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 @example {[\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"} }] Complete tests/src/Completion.res 36:2 @@ -421,7 +421,7 @@ Complete tests/src/Completion.res 38:2 "kind": 12, "tags": [], "detail": "(t<'a>, key) => 'a", - "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"} + "documentation": {"kind": "markdown", "value": " [unsafeGet dict key] return the value if the [key] exists, \n otherwise an {b 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@example {[\nArray.iter (fun key -> Js.log (Js_dict.unsafeGet dic key)) (Js_dict.keys dict) \n]} \n"} }, { "label": "unsafeDeleteKey", "kind": 12, diff --git a/analysis/tests/src/expected/Definition.res.txt b/analysis/tests/src/expected/Definition.res.txt index d88c9782a..ad02a11dd 100644 --- a/analysis/tests/src/expected/Definition.res.txt +++ b/analysis/tests/src/expected/Definition.res.txt @@ -8,5 +8,5 @@ Hover tests/src/Definition.res 14:14 {"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. "} Hover tests/src/Definition.res 18:14 -{"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"} +{"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 @example {[\n map [1;2] (fun x-> x + 1) = [3;4]\n ]}\n"} diff --git a/analysis/tests/src/expected/Hover.res.txt b/analysis/tests/src/expected/Hover.res.txt index 8302e089c..b7f762b14 100644 --- a/analysis/tests/src/expected/Hover.res.txt +++ b/analysis/tests/src/expected/Hover.res.txt @@ -23,7 +23,7 @@ Hover tests/src/Hover.res 37:13 {"contents": "```rescript\nstring\n```"} Hover tests/src/Hover.res 41:13 -{"contents": "```rescript\nstring\n```"} +null Hover tests/src/Hover.res 44:10 {"contents": "```rescript\nint\n```"}