Error are exported as twice

What does this error mean ?

File "/forge/src/c-cl/editor/ide/jv.ml", line 1, characters 0-0:
Error: Error are exported as twice
 head ide/jv.ml 
(*---------------------------------------------------------------------------
   Copyright (c) 2020 The brr programmers. All rights reserved.
   Distributed under the ISC license, see terms at the end of the file.
  ---------------------------------------------------------------------------*)

external pure_js_expr : string -> 'a = "caml_pure_js_expr"
external js_expr : string -> 'a = "caml_js_expr"

external wrap_callback : ('a -> 'b) -> 'c = "caml_js_wrap_callback"

The first few lines are comments. How is there an error on line 1 ?

Can you explain how you got this error? I.e. w hat steps did you take to reach this error. I can’t reproduce on my end. Here is what I did:

git clone https://github.com/rescript-lang/rescript-project-template test_rescript
cd test_rescript
npm i
rm src/Demo.res
curl -o src/jv.ml 'https://raw.githubusercontent.com/dbuenzli/brr/master/src/jv.ml'
npm res:dev

And I am getting a different error:

>>>> Start compiling 
Stale output removed
rescript: [3/3] src/jv.cmj
FAILED: src/jv.cmj
File "/Users/yawarquadiramin/src/test_rescript/src/jv.ml", line 16, characters 26-32:
Error: Unbound module Jstr
FAILED: cannot make progress due to previous errors.
>>>> Finish compiling(exit: 1)

brr’s Jv module has both an exception named Error and a module named Error. Doing that can trigger the error that you see.

Check out the playground for a min reproducible example.

There are a few places in the rescript compiler that trigger the error. It’s from the report_error function. (you can grep the rescript compiler source to find them)

  | Bs_duplicate_exports str ->
    Format.fprintf ppf "%s are exported as twice" str
2 Likes