jaredly / jaredly/reason-language-server
`Error: Unbound module Foo` with one switch, no errors with different switch
Nobody has claimed this yet.
- Dominant language
- OCaml
- Stars
- 649
- Forks
- 85
- PR merge metrics
- No merged PRs in 30d
Description
By happenstance, I'd been using `ocaml-variants.4.07.1+flambda` since before I started using this plugin, and all was well, until I started using `ocaml-base-compiler.4.07.1` (i.e. the "regular" switch?) earlier this week. After that change, any references to modules defined within my working directories fails with a squiggly popup reading `Error: Unbound module $module_name`.
Immediately around the error in the log is this:
```
<< Making lastDefinitions with type error for file:///home/chas/dev/project/test/testgeom.ml
type error here File "/home/chas/dev/project/_build/.lsp/testgeom__Testgeom.ast", line 1, characters 5-9:
Error: Unbound module Geom
Sending notification {"jsonrpc": "2.0", "method": "textDocument/publishDiagnostics", "params": {"uri": "file:///home/chas/dev/project/test/testgeom.ml", "diagnostics": [{"range": {"start": {"line": 0, "character": 5}, "end": {"line": 0, "character": 9}}, "message": "Error: Unbound module Geom", "severity": 1}]}}
```
Nothing spectacularly revealing. AFAICT, it's the same message produced by typing something that really doesn't exist `open Bzzzzt`.
The workaround for me currently is to just use the flambda switch. Perfectly fine of course, but (a) it seems like there's an actual problem here, and (b) I'm actually _not_ using flambda in CI/production because the programs in question actually are faster without it. :man_shrugging:
I can reproduce the problem at will with just:
```sh
opam switch 4.07
eval $(opam env)
rm -rf _build; dune runtest
```
…and then restarting the RLS to pick up the `.merlin` changes.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce with the listed opam switch, eval, dune runtest, and RLS restart commands, then inspect the generated .merlin changes and the RLS log around testgeom.ml. Compare module resolution under the regular and flambda switches. Done means modules from the working directory resolve under ocaml-base-compiler.4.07.1 without the unbound-module diagnostic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100