jaredly / jaredly/reason-language-server

No error reported when module doesn't match interface

Open
#380 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
OCaml
Stars
649
Forks
85
PR merge metrics
No merged PRs in 30d

Description

When I add an incorrect type to an `rei` file, there's no indication in vscode that compilation failed; the problems tab is empty. From the lsp logs (included below, but I'm happy to add more... it was hard to know what the relevant parts were), the language server seems to be aware of the fact that compilation failed.

Project structure:

- src
- ReludeRandom_Generator.re
- ReludeRandom.re
- ReludeRandom.rei

...where `ReludeRandom.re` has an alias like `module Generator = ReludeRandom_Generator;` and the interface for Generator lives in `ReludeRandom.rei`. If it helps, the whole project structure [is available here](https://github.com/reazen/relude-random/blob/e5d58723f5e96e177eb19187af5d15b818b0ad4e/src/ReludeRandom.rei).

```
>> Build system running: /home/michael/Projects/reazen/relude-random/node_modules/bs-platform/lib/bsb.exe -make-world
>>> stdout
bsb: no work to do.
bsb: no work to do.
bsb: no work to do.
[1/2] Building src/ReludeRandom.cmj
FAILED: src/ReludeRandom.cmj /home/michael/Projects/reazen/relude-random/src/ReludeRandom.bs.js
/home/michael/Projects/reazen/relude-random/node_modules/bs-platform/lib/bsc.exe -nostdlib -bs-package-name relude-random -bs-package-output commonjs:src -color always -bs-suffix -bs-read-cmi -I src -I /home/michael/Projects/reazen/relude-random/node_modules/bs-abstract/lib/ocaml -I /home/michael/Projects/reazen/relude-random/node_modules/relude/lib/ocaml -I /home/michael/Projects/reazen/relude-random/node_modules/bs-platform/lib/ocaml -w -30-40+6+7+27+32..39+44+45+101 -warn-error +A -o src/ReludeRandom.cmj src/ReludeRandom.reast

We've found a bug for you!
/home/michael/Projects/reazen/relude-random/src/ReludeRandom.re

The implementation /home/michael/Projects/reazen/relude-random/src/ReludeRandom.re
does not match the interface src/ReludeRandom.cmi:
...
In module Generator:
Values do not match:
let sample: list('a) => t(option('a))
is not included in
let sample: list('a) => t('a)
File "/home/michael/Projects/reazen/relude-random/src/ReludeRandom.rei", line 138, characters 2-31:
Expected declaration
File "/home/michael/Projects/reazen/relude-random/src/ReludeRandom_Generator.re", line 107, characters 4-10:
Actual declaration

FAILED: subcommand failed.
>>> stderr

Affected files: file:///home/michael/Projects/reazen/relude-random/src/ReludeRandom.re
Cleaning bsconfig.json
Sending notification {"jsonrpc": "2.0", "method": "textDocument/publishDiagnostics", "params": {"uri": "file:///home/michael/Projects/reazen/relude-random/bsconfig.json", "diagnostics": []}}
```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the mismatch using the ReludeRandom.re, ReludeRandom.rei, and ReludeRandom_Generator.re structure described in the report. Start by tracing the failed build output and the textDocument/publishDiagnostics notification for bsconfig.json; done means the interface mismatch appears in VSCode's Problems tab instead of an empty diagnostic list.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml, vscode
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.