leanprover-community / leanprover-community/lean

Relative import: problem with depth

Open
#396 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
433
Forks
79
PR merge metrics
No merged PRs in 30d

Description

When trying to use relative imports, I realized that they did not work for files with more than 3 levels of subdirectories. Browing on Zulip, I found a message from Mario (from 2018!) saying the following:

I guess no one has ever tried to use 7 dots in a row in relative imports, but it doesn't work. The = should be a += here, and I tested that if you put import .......test it counts as only one level up (and in general k dots means k mod 3 levels up)

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

Start in src/frontends/lean/parser.cpp around line 2422, as linked in the issue, and trace how repeated dots are counted for relative imports. Reproduce the behavior with imports such as .......test, then verify that different dot counts resolve the expected number of parent directories and that the existing import tests still pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.