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

Only munge internal dependencies when printing when there is no explicit syntax #10287

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ preProcessInternalDeps specVer gpd

transformD :: Dependency -> [Dependency]
transformD (Dependency pn vr ln)
| pn == thisPn =
| pn == thisPn && specVer < CabalSpecV3_0 =
if LMainLibName `NES.member` ln
then Dependency thisPn vr mainLibSet : sublibs
else sublibs
Expand All @@ -282,9 +282,12 @@ preProcessInternalDeps specVer gpd
]
transformD d = [d]

-- Always perform transformation for mixins as syntax was only introduced in 3.4
-- This guard is uncessary as no transformations take place when cabalSpec < CabalSpecV3_4 but
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you meant to use >=

-- it more clearly signifies the intent.
transformM :: Mixin -> Mixin
transformM (Mixin pn (LSubLibName uqn) inc)
| pn == thisPn =
| pn == thisPn && specVer < CabalSpecV3_4 =
mkMixin (unqualComponentNameToPackageName uqn) LMainLibName inc
transformM m = m

Expand Down
6 changes: 3 additions & 3 deletions Cabal-tests/tests/ParserTests/regressions/issue-6083-b.format
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ library
default-language: Haskell2010
build-depends:
base,
sublib
issue:sublib

library sublib
default-language: Haskell2010
Expand All @@ -15,10 +15,10 @@ executable demo-a
main-is: Main.hs
build-depends:
issue,
sublib
issue:sublib

executable demo-b
main-is: Main.hs
build-depends:
issue,
sublib
issue:sublib
2 changes: 1 addition & 1 deletion validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ CMD="$($CABALLISTBIN Cabal-tests:test:no-thunks-test) $TESTSUITEJOBS --hide-succ


# See #10284 for why this value is pinned.
HACKAGE_TESTS_INDEX_STATE="--index-state=2024-08-25"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR is tested by this change, as this hackage index has the failing .cabal file which failed to roundtrip.

HACKAGE_TESTS_INDEX_STATE="--index-state=2024-08-28"

CMD=$($CABALLISTBIN Cabal-tests:test:hackage-tests)
(cd Cabal-tests && timed $CMD read-fields $HACKAGE_TESTS_INDEX_STATE) || exit 1
Expand Down
Loading