From 6fc71302c6e786ffb1125f559885916e61ddaac7 Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Wed, 1 Nov 2023 11:35:37 +0100 Subject: [PATCH] Fix: support result in GenType. --- CHANGELOG.md | 3 ++ jscomp/gentype/TranslateTypeExprFromTypes.ml | 2 +- .../package-lock.json | 35 ++++++++++++------- .../src/ImportJsValue.bs.js | 2 +- .../src/Uncurried.bs.js | 2 +- 5 files changed, 28 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea5a19bb26..295c998810 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,9 @@ # 11.0.0-rc.6 (Unreleased) +#### :bug: Bug Fix +- Fix issue with GenType and `result` introduced in rc.5. https://github.com/rescript-lang/rescript-compiler/pull/6464 + # 11.0.0-rc.5 #### :rocket: New Feature diff --git a/jscomp/gentype/TranslateTypeExprFromTypes.ml b/jscomp/gentype/TranslateTypeExprFromTypes.ml index 0902bb9e59..a42cc6bb87 100644 --- a/jscomp/gentype/TranslateTypeExprFromTypes.ml +++ b/jscomp/gentype/TranslateTypeExprFromTypes.ml @@ -135,7 +135,7 @@ let translateConstr ~config ~paramsTranslation ~(path : Path.t) ~typeEnv = }; ] ); } - | ( (["Pervasives"; "result"] | ["Belt"; "Result"; "t"]), + | ( (["Pervasives"; "result"] | ["Belt"; "Result"; "t"] | ["result"]), [paramTranslation1; paramTranslation2] ) -> let case n name type_ = {case = {label = string_of_int n; labelJS = StringLabel name}; t = type_} diff --git a/jscomp/gentype_tests/typescript-react-example/package-lock.json b/jscomp/gentype_tests/typescript-react-example/package-lock.json index 29b93c0ee4..0a527573b2 100644 --- a/jscomp/gentype_tests/typescript-react-example/package-lock.json +++ b/jscomp/gentype_tests/typescript-react-example/package-lock.json @@ -22,6 +22,26 @@ "typescript": "^5.2.2" } }, + "../../..": { + "name": "rescript", + "version": "11.0.0-rc.5", + "dev": true, + "hasInstallScript": true, + "license": "SEE LICENSE IN LICENSE", + "bin": { + "bsc": "bsc", + "bstracing": "lib/bstracing", + "rescript": "rescript" + }, + "devDependencies": { + "mocha": "10.1.0", + "nyc": "15.0.0", + "prettier": "2.7.1" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@aashutoshrathi/word-wrap": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", @@ -1399,19 +1419,8 @@ } }, "node_modules/rescript": { - "version": "11.0.0-rc.5", - "resolved": "file:../../..", - "dev": true, - "hasInstallScript": true, - "license": "SEE LICENSE IN LICENSE", - "bin": { - "bsc": "bsc", - "bstracing": "lib/bstracing", - "rescript": "rescript" - }, - "engines": { - "node": ">=10" - } + "resolved": "../../..", + "link": true }, "node_modules/resolve-from": { "version": "4.0.0", diff --git a/jscomp/gentype_tests/typescript-react-example/src/ImportJsValue.bs.js b/jscomp/gentype_tests/typescript-react-example/src/ImportJsValue.bs.js index 2422200f62..69f8ca32c7 100644 --- a/jscomp/gentype_tests/typescript-react-example/src/ImportJsValue.bs.js +++ b/jscomp/gentype_tests/typescript-react-example/src/ImportJsValue.bs.js @@ -28,7 +28,7 @@ var areaValue = ImportJsValueGen$1.area({ function getAbs(x) { var getAbs$1 = x.getAbs; - return getAbs$1(undefined); + return getAbs$1(); } var AbsoluteValue = { diff --git a/jscomp/gentype_tests/typescript-react-example/src/Uncurried.bs.js b/jscomp/gentype_tests/typescript-react-example/src/Uncurried.bs.js index 7bc1df3326..5878196f58 100644 --- a/jscomp/gentype_tests/typescript-react-example/src/Uncurried.bs.js +++ b/jscomp/gentype_tests/typescript-react-example/src/Uncurried.bs.js @@ -31,7 +31,7 @@ function callback2(auth) { } function callback2U(auth) { - return auth.loginU(undefined); + return auth.loginU(); } function sumU(n, m) {