Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imports not working for module names with dots #2999

Closed
1 task done
ajs1998 opened this issue Nov 30, 2023 · 0 comments · Fixed by #2994
Closed
1 task done

Imports not working for module names with dots #2999

ajs1998 opened this issue Nov 30, 2023 · 0 comments · Fixed by #2994
Labels
bug Something isn't working

Comments

@ajs1998
Copy link

ajs1998 commented Nov 30, 2023

Prerequisites

  • Put an X between the brackets on this line if you have done all of the following:
    • Check that your issue is not already filed.
    • Reduce the issue to a minimal, self-contained, reproducible test case. Avoid dependencies to mathlib4 or std4.

Description

To import a file A/B.C.lean, import «A».«B.C» instead tries to find a file called A/B.lean.

The workaround was to use import «A».«B.C.lean» instead.

Context

Bug described here

Steps to Reproduce

  1. Create a file A/B.C.lean
  2. Try to import it from a different file with import «A».«B.C»

Expected behavior: Import works

Actual behavior:

`/home/vscode/.elan/toolchains/leanprover--lean4---v4.2.0/bin/lake print-paths Init «A».«B.C» --no-build` failed:

stderr:
error: '«A».«B.C»': no such file or directory (error code: 2)
  file: ./././A/B.lean

Versions

Lean v4.2.0

Additional Information

[Additional information, configuration or data that might be necessary to reproduce the issue]

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

@ajs1998 ajs1998 added the bug Something isn't working label Nov 30, 2023
github-merge-queue bot pushed a commit that referenced this issue Jan 10, 2024
This introduces `FilePath.addExtension` to take a path that we know has
no prior extension, and append a new extension to it.
As this function is simpler than `FilePath.withExtension`, this change
eagerly replaces uses of the latter with the former, except in a few
cases where stripping the extension really is the right thing to do.

This should fix the bug described at
https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/Import.20file.20with.20multiple.20dots.20in.20file.20name/near/404508048,
where `import «A.B».«C.D.lean»` is needed to import `A.B/C.D.lean`.

Closes #2999

---------

Co-authored-by: Mac Malone <tydeu@hatpress.net>
Co-authored-by: Sebastian Ullrich <sebasti@nullri.ch>
@Kha Kha closed this as completed in #2994 Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant