leanprover-community / leanprover-community/lean
Using `set_cwd` breaks the consistency of re-running parts of a Lean file
Open
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 434
- Forks
- 79
- PR merge metrics
- No merged PRs in 30d
Description
In an editor, put the following in a Lean file:
def bar := ()
run_cmd
unsafe_run_io $ do
{ io.env.get_cwd >>= io.print_ln,
io.env.set_cwd "foo",
io.env.get_cwd >>= io.print_ln }
/some/path/
/some/path/foo/
without restarting the Lean server, comment out the bar definition:
-- def bar := ()
run_cmd
unsafe_run_io $ do
{ io.env.get_cwd >>= io.print_ln,
io.env.set_cwd "foo",
io.env.get_cwd >>= io.print_ln }
/some/path/foo/
/some/path/foo/foo/
Contributor guide
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 the issue in a Lean file using the shown run_cmd and unsafe_run_io sequence, first with and then without the bar definition. Start by tracing how the editor reruns parts of the file and how the Lean server handles io.env.get_cwd and io.env.set_cwd. Done means rerunning the remaining command does not inherit the prior working-directory change.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100