Compile errors with `dune runtest`

I wanted to try the Bank kata in OCaml and play a bit with ppx_expect but I’ve ran into a strange issue, that I’m not sure if it’s a bug or something I’ve done wrong.

I’m on linux, with opam 2.0 and ocaml 4.07.0

So I have a file lib/

let create () = ()

let deposit _ _ = ()

let withdrawal _ _ = ()

let print _ =
  print_endline "TODO"

and a test: test/

open! Base
open! Stdio

let%expect_test "Printing the statements should contain all transactions" =
  Lib.Account.create ()
  |> Lib.Account.deposit 500
  |> Lib.Account.withdrawal 200
  |> Lib.Account.print;
  [%expect{| |}]

now when I run dune runtest the first time everything is ok. If I now change TODO to something else and run dune runtest again I get the following error:

File "_none_", line 1:
Error: Files test/test.cmxa and lib/lib.cmxa
       make inconsistent assumptions over implementation Lib__Account

If I remove _build/default/test then everything works fine again, but as soon as I change something again I get the same error.

Am I doing something wrong or is this a bug? And if it is a bug, any idea where I should report it?

Which version of dune are you using?

dune --version

See if you can reproduce the bug with 1.1.1

Thanks that fixed it. I didn’t run opam update (didn’t know that opam install looked locally for available versions)