-
Notifications
You must be signed in to change notification settings - Fork 704
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
--build-depends with repl does not consume its list of inputs if it sees allow-newer #6859
Comments
@emilypi do you happen to have I encountered this bug too. I found that it does not trigger if I comment A reason could be that --- a/Cabal-syntax/src/Distribution/Types/GenericPackageDescription.hs
+++ b/Cabal-syntax/src/Distribution/Types/GenericPackageDescription.hs
@@ -93,12 +93,18 @@ traverseCondTreeBuildInfo
:: forall f comp v. (Applicative f, L.HasBuildInfo comp)
=> LensLike' f (CondTree v [Dependency] comp) L.BuildInfo
traverseCondTreeBuildInfo g = node where
- mkCondNode :: comp -> [CondBranch v [Dependency] comp] -> CondTree v [Dependency] comp
- mkCondNode comp branches = CondNode comp (view L.targetBuildDepends comp) branches
+ mkCondNode
+ :: comp
+ -> [Dependency]
+ -> [CondBranch v [Dependency] comp]
+ -> CondTree v [Dependency] comp
+ mkCondNode comp deps = CondNode comp (view L.targetBuildDepends comp <> deps)
- node (CondNode comp _ branches) = mkCondNode
- <$> L.buildInfo g comp
- <*> traverse branch branches
+ node (CondNode comp deps branches) = mkCondNode
+ <$> L.buildInfo g comp
+ -- [HACK] we cannot operate on dependencies directly
+ <*> fmap (view L.targetBuildDepends) (g (set L.targetBuildDepends deps mempty))
+ <*> traverse branch branches
branch (CondBranch v x y) = CondBranch v
<$> node x |
@wismill if you solved this, that would be awesome: that was such a showstopper! |
Well it is hacky but it is solved in my case (namely run doctest). However I do not know if it works in general. I would prefer a bit more feedback before opening a PR. |
@wismill is you submit a PR, we'll see what ci thinks, which is a good first approximation. |
@ulysses4ever PR sent. See my comments on the hacks. Let’s see first if it passes the test suite. |
Note that this bug triggers also using |
UPD 2023-02-03 Originally, the bug report suggested that the bug is always there, with any project file. It was later discovered by @wismill that the bug only manifests if cabal sees
allow-newer
-- either in the project file or in the command-line arguments.Describe the bug
The
--build-depends
flag does not seem to be respected within a project dir, but oddly works outside of it. I'd expect the following to bring the list of dependencies into scope for the repl for a project, but it does not:However, if i step outside of the project directory, it works:
To Reproduce
Run the above commands.
Expected behavior
I would expect the behavior of
--build-depends
to be concatenative (modulo conflicts), and work the same inside of a project directory as well as outside.System information
The text was updated successfully, but these errors were encountered: