leanprover / leanprover/lean4

Better import errors

Open
#1,438 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement P-medium server
Dominant language
Lean
Stars
9.2k
Forks
990
Avg merge
1d 17h
Merged PRs (30d)
175

Description

This is not something I expect to get fixed overnight, but this is an issue to track improvements in import errors.

Currently, any errors in file A will cause file B that imports A to get an error at B.lean:1:1 which contains the dump of the lake invocation. This means that the error is both not localized to the actual failing import, and also the error itself is buried in a stream of other data.

If we play "what would Rust do", we shouldn't report import errors in file B at all, but rather we should put an error inside file A, while elaborating B, assuming we haven't already done so. LSP does allow you to do this. If A happens to be outside the project, then this may not be helpful, so in that case I would suggest putting the error on the import line for the first workspace file to import A.

Contributor guide

Open the contributing guide

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 file A/file B import-error case described in the issue and inspect how LSP reports diagnostics during elaboration. Done means errors are localized to A when possible, or to the import line for the first workspace file when A is external, rather than reported only at B:1:1 with the lake dump.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.