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

Fix :show targets / :show paths parsing logic #294

Merged
merged 1 commit into from
Jun 21, 2024

Conversation

9999years
Copy link
Member

Previously, if :show targets displayed a path, we would attempt to join that path to each of the module search paths and to GHCi's working directory to find the file.

In reality, GHCi only checks such paths relative to its working directory. (Indeed, if you change the working directory with :cd, GHCi will unload all modules. 1)

Also, the logic for checking these paths was broken, considering that the search paths can be relative to the working directory, but we weren't properly joining these paths.

In the future, I'll write some tests that do --after-startup-ghci ":cd ../" and see how much of ghciwatch explodes.

Previously, if `:show targets` displayed a path, we would attempt to
join that path to each of the module search paths and to GHCi's working
directory to find the file.

In reality, GHCi only checks such paths relative to its working
directory. (Indeed, if you change the working directory with `:cd`, GHCi
will unload all modules. [1])

Also, the logic for checking these paths was broken, considering that
the search paths can be relative to the working directory, but we
weren't properly joining these paths.

In the future, I'll write some tests that do `--after-startup-ghci
":cd ../"` and see how much of ghciwatch explodes.

[1]: https://gitlab.haskell.org/ghc/ghc/-/blob/077cb2e11fa81076e8c9c5f8dd3bdfa99c8aaf8d/compiler/GHC.hs#L1073-L1083
@9999years 9999years added the patch Bug fixes or non-functional changes label Jun 13, 2024
Copy link

linear bot commented Jun 13, 2024

@9999years 9999years marked this pull request as ready for review June 13, 2024 17:55
@9999years 9999years requested a review from atruslow June 14, 2024 19:44
@9999years 9999years merged commit 910c4c3 into main Jun 21, 2024
40 checks passed
@9999years 9999years deleted the rebeccat/dux-2339-add-tests-for-normalpath branch June 21, 2024 17:59
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Bug fixes or non-functional changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants