-
Notifications
You must be signed in to change notification settings - Fork 119
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
Spurious Unbound module Foo
after making changes in foo.ml
#1209
Labels
bug
Something isn't working
Comments
I made a fairly minimal reproduction: #!/bin/sh
cat >dune-project <<EOF
(lang dune 3.11)
EOF
cat >main.ml <<EOF
open Lib
let () = print_string v
EOF
cat >lib.ml <<EOF
let v = "42"
EOF
cat >dune <<EOF
(executable
(name main)
(modules main)
(libraries lib))
(library
(name lib)
(modules lib))
EOF
opam switch create . 5.1.0
ocaml-platform
# Inferring tools version...
# -> dune.3.11.1 will be built from source
# -> dune-release.2.0.0 will be installed from cache
# -> merlin.4.12-501 will be installed from cache
# -> ocaml-lsp-server.1.16.2 will be installed from cache
# -> odoc.2.3.0 will be installed from cache
# -> ocamlformat.0.26.1 will be installed from cache
dune build
###################
#### No issue with manual builds
# 1. Introduce an error in lib and rebuild:
# cat >lib.ml <<EOF
# let v : float = "42"
# EOF
# 2. Now lsp says, in main.ml:
# ocamllsp: Unbound module Lib
# 3. Fix the error and rebuild:
# cat >lib.ml <<EOF
# let v = "42"
# EOF
# 4. lsp has no more errors
####################
##### But with dune -watch
# 1. Run `dune build -w`
# 2. Introduce the same error than before
# 3. LSP shows unbound module error in main.ml
# 4. Fix the issue, dune should rebuild ok
# 5. Go back to main.ml. Unbound module error stays even after edit, even after
# exiting and restarting dune. Only restarting the lsp removes the stalled
# error. @rgrinberg : I guess the issue is likely due to Dune RPC since manual dune builds don't triggers it. It happens quite often when working on a project with dune watch active. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's not 100% reproducible in my project, but the following seems to work:
let x = "a" + 42
at the bottom)Unbound module Compare
(somewhat expected, as there is no mli)Unbound module Compare
error in main.ml is still thereRelevant for reproduction, I open both files in the same vim instance, and use the following to autosave on every change:
Restarting lsp fixes the issue. Other changes to either ml file seem to preserve the issue.
Here is a recording: https://asciinema.org/a/6HG60xy5grl0hlF5BxMcxxPLK
And the lsp logfile: lsp.log
The text was updated successfully, but these errors were encountered: