Refactor/before import warning#11773
Open
philderbeast wants to merge 13 commits intohaskell:masterfrom
Open
Conversation
7fc0f5e to
83257e1
Compare
6 tasks
ulysses4ever
approved these changes
May 3, 2026
Collaborator
ulysses4ever
left a comment
There was a problem hiding this comment.
Thanks a lot for splitting it --- it helped reviewing a lot! A couple nitpicks inline.
| -- The +legacy-comparison flag is to set the default project file parser to compare | ||
| -- the result of the legacy and parsec parser and fail if they are not equal. | ||
| package cabal-install | ||
| flags: +git-rev +legacy-comparison |
Collaborator
There was a problem hiding this comment.
Is this change necessary? I dislike unrelated changes even if they are good changes on their own. But I won't block on this.
Collaborator
Author
There was a problem hiding this comment.
Yes it is. With +legacy-comparison both legacy and parsec parsers are emitting the untrimmedUriImportMsg message. This leads to a test failure:
UNEXPECTED FAIL: PackageTests/ProjectImport/UntrimmedImport/cabal.test.hs
The test expects only one instance of this error for each build:
Here's the test diff with the warning repeated:
$ cabal build all --enable-tests -j --semaphore --ghc-options="-Werror" \
--project-file=cabal.validate.project
$ cabal run cabal-testsuite:cabal-tests -- \
--with-cabal=./dist-newstyle/build/x86_64-linux/ghc-9.14.1/cabal-install-3.17.0.0/x/cabal/build/cabal/cabal \
cabal-testsuite/PackageTests/ProjectImport/UntrimmedImport/cabal.test.hs
...
Actual output differs from expected:
# STDERR:
--- /tmp/cabal-testsuite-712126/cabal.dist/cabal.out.normalized 2026-05-04 14:40:41.311315596 -0400
+++ /tmp/cabal-testsuite-712126/cabal.dist/cabal.comp.out.normalized 2026-05-04 14:40:41.311270635 -0400
@@ -3,6 +3,9 @@
Warning: import has leading or trailing whitespace;
'https://www.stackage.org/nightly-2024-12-05/cabal.config '
imported by: trailing-space.project
+Warning: import has leading or trailing whitespace;
+ 'https://www.stackage.org/nightly-2024-12-05/cabal.config '
+ imported by: trailing-space.project
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following would be built:
@@ -12,6 +15,9 @@
Warning: import has leading or trailing whitespace;
'https://www.stackage.org/nightly-2024-12-05/cabal.config '
imported by: tabs-and-spaces.project
+Warning: import has leading or trailing whitespace;
+ 'https://www.stackage.org/nightly-2024-12-05/cabal.config '
+ imported by: tabs-and-spaces.project
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following would be built:
cabal.test.hs: Uncaught exception ghc-internal:GHC.Internal.Exception.ErrorCall:
FAIL
HasCallStack backtrace:
throwIO, called at src/Test/Cabal/Monad.hs:533:24 in cabal-testsuite-3-inplace:Test.Cabal.Monad83257e1 to
0874d33
Compare
Nest fetchImportConfig within fetchImportParse
00be280 to
7310351
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split from #10933, the refactoring and the sorting changes without the duplicate import by alternate paths detection, as requested by @ulysses4ever.
cabal-install/src/Distribution/Client/ProjectConfig/Import.hsand move some stuff there fromcabal-install-solver/src/Distribution/Solver/Types/ProjectConfigPath.hsthat was only ever used incabal-install.For messages, I added some doctests and ended up with two ways of comparing
ProjectConfigPath.I'll squash commits before applying the merge label if this pull request is approved.
Template Α: This PR modifies behaviour or interface
Include the following checklist in your PR:
significance: significantin the changelog file.