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

coqsplit.ml: error with string not bytes #14

Closed
spl opened this issue Feb 2, 2018 · 2 comments
Closed

coqsplit.ml: error with string not bytes #14

spl opened this issue Feb 2, 2018 · 2 comments

Comments

@spl
Copy link
Contributor

spl commented Feb 2, 2018

I ran into this error:

$ cd Stlc; make
ocamlc.opt coqsplit.ml -o coqsplit
File "coqsplit.ml", line 295, characters 15-28:
Warning 3: deprecated: String.create
Use Bytes.create instead.
File "coqsplit.ml", line 420, characters 34-35:
Error: This expression has type bytes but an expression was expected of type
         string
make: *** [coqsplit] Error 2

I'm guessing this is a problem with a newer OCaml:

$ ocamlc.opt --version
4.06.0

Perhaps it's due the change to immutable strings in OCaml-4.02?

I “fixed” it with the following patch, but I have no confidence that it's correct (I'm not using the output of coqsplit.ml):

diff --git a/Stlc/coqsplit.ml b/Stlc/coqsplit.ml
index 7a5a9b4..00b3675 100644
--- a/Stlc/coqsplit.ml
+++ b/Stlc/coqsplit.ml
@@ -291,10 +291,7 @@ let spec =
 (* tools to read and process tags on the input strings *)

 let readchan chan =
-  let nbytes = in_channel_length chan in
-  let string = String.create nbytes in
-  really_input chan string 0 nbytes;
-  string
+  really_input_string chan 0

 let findsubstring s1 s2 =
   let l1 = String.length s1 in
@sweirich
Copy link
Contributor

sweirich commented Mar 6, 2019

There is also a fix for this issue in PR #15 (which I don't want to merge yet). I'm also not using the output of coqsplit so I don't know if either suffice.

@sweirich
Copy link
Contributor

sweirich commented Jan 8, 2020

Fixed by c716013

@sweirich sweirich closed this as completed Jan 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants