Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bytes_to_string is missing #5573

Closed
TheSpyder opened this issue Jul 20, 2022 · 0 comments · Fixed by #5580 or #5589
Closed

bytes_to_string is missing #5573

TheSpyder opened this issue Jul 20, 2022 · 0 comments · Fixed by #5580 or #5589
Labels
Milestone

Comments

@TheSpyder
Copy link
Contributor

Using 10.0.0-beta.3 I'm getting an error in my bundler:

▲ [WARNING] Import "bytes_to_string" will always be undefined because there is no matching export in "node_modules/rescript/lib/es6/caml_bytes.js"

    node_modules/rescript/lib/es6/char.js:67:26:
      67 │         return Caml_bytes.bytes_to_string(s);
         ╵                           ~~~~~~~~~~~~~~~

And tracking down that JS to the OCaml library code, it's coming from char.ml's use of unsafe_to_string.
https://github.com/rescript-lang/rescript-compiler/blob/375cc68473d08d8357531b7cb48a91fec27a34f5/jscomp/stdlib-406/char.ml#L27-L47

Now, unsafe_to_string does exist in bytes.ml:
https://github.com/rescript-lang/rescript-compiler/blob/375cc68473d08d8357531b7cb48a91fec27a34f5/jscomp/stdlib-406/bytes.ml#L158
But char is using %bytes_to_string which compiles to Caml_bytes.bytes_to_string.

It looks like the caml_bytes.ml code was deleted in May 2021, which is also when bytes.ml had the implementation added, but the usages of it weren't updated.
5215218#diff-0dd01a00ddd500dee6f9586505eae3c732df832649a86d5770e2c2f454e9626bL123-L124

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants