-
Notifications
You must be signed in to change notification settings - Fork 697
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
Prepend hs-source-dir to match-component #6622 #6623
Conversation
Is this feature of the repl documented in the manual? Now might be a good time to do so. |
I am happy to update any documentation for |
re docs, there are sections for There are also |
c374937
to
8a5003d
Compare
The windows error seems to be that the following works on windows: $ cabal repl p:app\Main.hs but this doesnt: $ cabal repl p:app/Main.hs However, both $ cabal repl app/Main.hs
$ cabal repl app\Main.hs work. Is it ok to fix that in this PR, too? EDIT: fixed it. |
4f74695
to
f494fe1
Compare
8b8c726
to
1a71c7d
Compare
Add Integration test for Target Selecetors for files that are part of other-modules in sub-directories.
1a71c7d
to
267b0d6
Compare
267b0d6
to
3fe7219
Compare
So, currently there is an internal error when the file target is ambiguous, e.g. target is part of two executables, therefore hard to actually test for. The bug-fix for that is relatively simple, however, I feel like this PR is already bigger than planned. |
I'm on the fence with this. Something tells me that |
Yeah, but it fails. I assume it is just some minor bug, somewhere in target matching.
What is all of the project in the case of a library? Wouldnt "library" be the component to build? However, please note, that not behaviour is introduced by this patch. This patch only fixes two bugs regarding finding the component associated with the module. |
I imagine use case: cd some-library # go to library sources
vim ExampleBug.hs # quickly hack some example file
cabal repl ExampleBug.hs # load it into repl This is very common workflow for myself, but I have to rely on local Yet, I don't understand what is the motivation to be able to select OTOH out-of-package source file and in package source files should |
@phadej The motivation to select a component by a source file is to implement an IDE which can create the right session given any FilePath. This patch just fixes the existing behavior as far as I understand. |
Would this be accomplished by #6149? Or rather, could we accomplish it that way? |
@mpickering I see. That's enough for me for a motivation. |
So, is there anything blocking this for getting merged? I would be happy if this bug-fix can make it into the next release. |
3fe7219
to
9fef1d6
Compare
Is it ok if I merge this? Ideally before #6774 is merged so this PR does not need to be rebased. |
Assuming no major delays here I can hold off until this PR is merged. |
I am just waiting for approval (or requesting changes). Dont want to go over anyone's head. |
what happens if executable name is Is that ambiguous, how to resolve ambiguity? |
I see
selectors in text but have no idea what they mean (by looking at the documentation changes). |
@@ -247,9 +247,15 @@ testTargetSelectors reportSubCase = do | |||
":pkg:p:lib:p:file:P.y" | |||
, "q/QQ.hs", "q:QQ.lhs", "lib:q:QQ.hsc", "q:q:QQ.hsc", | |||
":pkg:q:lib:q:file:QQ.y" | |||
, "q/Q.hs", "q:Q.lhs", "lib:q:Q.hsc", "q:q:Q.hsc", | |||
":pkg:q:lib:q:file:Q.y" | |||
, "app/Main.hs", "p:app/Main.hs", "exe:ppexe:app/Main.hs", "p:ppexe:app/Main.hs", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also add a test that Main.hs
should be ambiguous?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, an ambiguous target selector makes sense, going to update it asap!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am sorry, I am not sure I get what you are saying?
Do you mean to add a test for the case that Main.hs
is ambiguous? Since it should be a filepath, I dont think it can be ambiguous?
I dont know a lot about the module syntax, but the current (3.2.0.0) behaviour is that the executable is chosen. If this is not clear enough, we can remove the module syntax from the documentation.
That is mainly copied from the other test-cases. I read the latter as the most verbose version of a file-target syntax while the former is the same for |
There exists a test for it already: -- local components shadow modules and files
reportSubCase "unambiguous: cwd comp vs module, file"
assertUnambiguous "Foo"
(mkTargetComponent "bar" (CExeName "Foo"))
[ mkpkg "bar" [mkexe "Foo"]
, mkpkg "other" [ mkexe "other" `withModules` ["Foo"]
, mkexe "other2" `withCFiles` ["Foo"] ]
] |
Merged via #6826 |
Why this change?
The function
matchFile
expects arguments of a form such as:but the old implementation produces the following:
since it doesnt prepend in the
hsSourceDirs
for eachother-module
.Please include the following checklist in your PR:
[ci skip]
is used to avoid triggering the build bots.[ ] Add tests for ambiguous filepath targetsPlease also shortly describe how you tested your change. Bonus points for added tests!
closes #6622