Skip to content

Test suite with a cyclic dependency no longer working #5200

Closed
@tswelsh

Description

@tswelsh

This was discovered when using stack, the relevant issue is here: commercialhaskell/stack#3892. Copying the summary from there:

We have a project with package A that exposes a library and has a test module. Package B depends on A and exposes a library that is used by A's test suite (the reason for this is that package B is used by other packages). So there is a circularish dependency going on, which works when building with GHC 8.0.2 but not GHC 8.2.2. Not sure if this is stack or cabal or GHC or what, but I thought that stack has code to deal with this situation (checking whether it can do an all in one build, I think?), so perhaps something changed in GHC or cabal that stops it from working.

Steps to reproduce

Minimal example here: https://github.com/dten/CouldntMatchTypeRepro. Changing the resolver in the stack.yaml between LTS 9 and LTS 10 exhibits the change in behaviour.

After poking around it seems like stack's behaviour hasn't changed. I tried to replicate what stack does under the hood with cabal install 2.0.0.0 on that project. Using cabal install in the model dir, then cabal install in the testing dir, then cabal configure --enable-tests && cabal build in the model dir gives the same error as when using stack, as expected. I haven't used the new-* ommands much before, but making a basic cabal.project and trying cabal new-configure in the model directory reuslts in:

Warning: The package list for 'hackage.haskell.org' is 97 days old.
Run 'cabal update' to get the latest list of available packages.
Resolving dependencies...
cabal.exe: Could not resolve dependencies:
trying: not-working-model-0.0.0 (user goal)
next goal: not-working-testing (user goal)
rejecting: not-working-testing-0.1.0.0 (cyclic dependencies; conflict set:
not-working-model, not-working-testing)
fail (backjumping, conflict set: not-working-model, not-working-testing)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: not-working-model, not-working-testing

(I changed the names because it looks like model is a package already on Hackage, so didn't want to confuse the matter). Is this a supported project configuration/workflow? Will it be in the future? It felt quite natural and useful to do at the time.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions