From 62492252c6f778fb3058393aae62e76bdc58142e Mon Sep 17 00:00:00 2001 From: Florian Hammerschmidt Date: Fri, 4 Oct 2024 14:39:50 +0200 Subject: [PATCH] Remove js_cast.res --- CHANGELOG.md | 1 + lib/es6/js_cast.js | 1 - lib/js/js_cast.js | 1 - packages/artifacts.txt | 8 ------ runtime/js_cast.res | 27 ------------------ runtime/js_cast.resi | 48 ------------------------------- tests/tests/src/js_cast_test.js | 49 -------------------------------- tests/tests/src/js_cast_test.res | 24 ---------------- 8 files changed, 1 insertion(+), 158 deletions(-) delete mode 100644 lib/es6/js_cast.js delete mode 100644 lib/js/js_cast.js delete mode 100644 runtime/js_cast.res delete mode 100644 runtime/js_cast.resi delete mode 100644 tests/tests/src/js_cast_test.js delete mode 100644 tests/tests/src/js_cast_test.res diff --git a/CHANGELOG.md b/CHANGELOG.md index d3b4a9819e..80ba6dbb4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ - OCaml compatibility in the stdlib and primitives are dropped/deprecated. https://github.com/rescript-lang/rescript-compiler/pull/6984 - Remove the JSX v3. https://github.com/rescript-lang/rescript-compiler/pull/7072 +- Remove js_cast.res. https://github.com/rescript-lang/rescript-compiler/pull/7075 #### :rocket: New Feature diff --git a/lib/es6/js_cast.js b/lib/es6/js_cast.js deleted file mode 100644 index ae1b9f17e6..0000000000 --- a/lib/es6/js_cast.js +++ /dev/null @@ -1 +0,0 @@ -/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */ diff --git a/lib/js/js_cast.js b/lib/js/js_cast.js deleted file mode 100644 index ae1b9f17e6..0000000000 --- a/lib/js/js_cast.js +++ /dev/null @@ -1 +0,0 @@ -/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */ diff --git a/packages/artifacts.txt b/packages/artifacts.txt index 45baf9eb4c..dfbd4c45af 100644 --- a/packages/artifacts.txt +++ b/packages/artifacts.txt @@ -79,7 +79,6 @@ lib/es6/js_array.js lib/es6/js_array2.js lib/es6/js_bigint.js lib/es6/js_blob.js -lib/es6/js_cast.js lib/es6/js_console.js lib/es6/js_date.js lib/es6/js_dict.js @@ -200,7 +199,6 @@ lib/js/js_array.js lib/js/js_array2.js lib/js/js_bigint.js lib/js/js_blob.js -lib/js/js_cast.js lib/js/js_console.js lib/js/js_date.js lib/js/js_dict.js @@ -559,12 +557,6 @@ lib/ocaml/js_blob.cmi lib/ocaml/js_blob.cmj lib/ocaml/js_blob.cmt lib/ocaml/js_blob.res -lib/ocaml/js_cast.cmi -lib/ocaml/js_cast.cmj -lib/ocaml/js_cast.cmt -lib/ocaml/js_cast.cmti -lib/ocaml/js_cast.res -lib/ocaml/js_cast.resi lib/ocaml/js_console.cmi lib/ocaml/js_console.cmj lib/ocaml/js_console.cmt diff --git a/runtime/js_cast.res b/runtime/js_cast.res deleted file mode 100644 index 07135415d9..0000000000 --- a/runtime/js_cast.res +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (C) 2015-2016 Bloomberg Finance L.P. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * In addition to the permissions granted to you by the LGPL, you may combine - * or link a "work that uses the Library" with a publicly distributed version - * of this file to produce a combined library or application, then distribute - * that combined work under the terms of your choosing, with no requirement - * to comply with the obligations normally placed on you by section 4 of the - * LGPL version 3 (or the corresponding section of a later version of the LGPL - * should you choose to use a later version). - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -external intOfBool: bool => int = "%identity" - -external floatOfInt: int => float = "%identity" diff --git a/runtime/js_cast.resi b/runtime/js_cast.resi deleted file mode 100644 index 8ef323b732..0000000000 --- a/runtime/js_cast.resi +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (C) 2015-2016 Bloomberg Finance L.P. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * In addition to the permissions granted to you by the LGPL, you may combine - * or link a "work that uses the Library" with a publicly distributed version - * of this file to produce a combined library or application, then distribute - * that combined work under the terms of your choosing, with no requirement - * to comply with the obligations normally placed on you by section 4 of the - * LGPL version 3 (or the corresponding section of a later version of the LGPL - * should you choose to use a later version). - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/*** -Safe cast between OCaml values which share the same -runtime representation - -Different OCaml types might share the same represention in the -ReScript runtime; while this is a compiler internal knowledge, -applications might benefit from having a safe and zero cost -conversion between those types. - -This modules acts as the **single place** for such conversion. - -If for any reason, the runtime representation changes, those function -will be modified accordingly. -*/ - -/** -`intOfBool(b)` returns `1` for when `b` is `true` and `0` when `b` is `false` -*/ -external intOfBool: bool => int = "%identity" - -/** -`floatOfInt(i)` returns the float value of `i` -*/ -external floatOfInt: int => float = "%identity" diff --git a/tests/tests/src/js_cast_test.js b/tests/tests/src/js_cast_test.js deleted file mode 100644 index f4730c7c66..0000000000 --- a/tests/tests/src/js_cast_test.js +++ /dev/null @@ -1,49 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -let Mt = require("./mt.js"); - -let suites = { - contents: /* [] */0 -}; - -let counter = { - contents: 0 -}; - -function add_test(loc, test) { - counter.contents = counter.contents + 1 | 0; - let id = loc + (" id " + counter.contents.toString()); - suites.contents = { - hd: [ - id, - test - ], - tl: suites.contents - }; -} - -function eq(loc, x, y) { - add_test(loc, () => ({ - TAG: "Eq", - _0: x, - _1: y - })); -} - -eq("File \"js_cast_test.res\", line 14, characters 12-19", true, 1); - -eq("File \"js_cast_test.res\", line 16, characters 12-19", false, 0); - -eq("File \"js_cast_test.res\", line 18, characters 12-19", 0, 0.0); - -eq("File \"js_cast_test.res\", line 20, characters 12-19", 1, 1.0); - -eq("File \"js_cast_test.res\", line 22, characters 12-19", 123456789, 123456789.0); - -Mt.from_pair_suites("Js_cast_test", suites.contents); - -exports.suites = suites; -exports.add_test = add_test; -exports.eq = eq; -/* Not a pure module */ diff --git a/tests/tests/src/js_cast_test.res b/tests/tests/src/js_cast_test.res deleted file mode 100644 index b38c6ea5b2..0000000000 --- a/tests/tests/src/js_cast_test.res +++ /dev/null @@ -1,24 +0,0 @@ -let suites: ref = ref(list{}) - -let add_test = { - let counter = ref(0) - (loc, test) => { - incr(counter) - let id = loc ++ (" id " ++ Js.Int.toString(counter.contents)) - suites := list{(id, test), ...suites.contents} - } -} - -let eq = (loc, x, y) => add_test(loc, _ => Mt.Eq(x, y)) - -let () = eq(__LOC__, Js_cast.intOfBool(true), 1) - -let () = eq(__LOC__, Js_cast.intOfBool(false), 0) - -let () = eq(__LOC__, Js_cast.floatOfInt(0), 0.0) - -let () = eq(__LOC__, Js_cast.floatOfInt(1), 1.0) - -let () = eq(__LOC__, Js_cast.floatOfInt(123456789), 123456789.0) - -let () = Mt.from_pair_suites(__MODULE__, suites.contents)