Only munge internal dependencies when printing when there is no explicit syntax #10287
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.
Only munge internal dependencies when printing when there is no explicit syntax
In
postProcessInternalDeps
the shadowing logic which existed prior to cabal format 3.4 is implemented in a post processing step.The algorithm there replaces any references to internal sublibraries with an explicit qualifier. For example if you write..
this is reinterpreted as
In
preProcessInternalDeps
the inverse transformation takes place, the goal is to replacemylib:foo
with justfoo
.Things go wrong if you are using version 3.0 for your cabal file because
So the situation is that the user is explicit about the sublibrary
mylib:{mylib, foo}
into two dependencies,mylib
andfoo
(no qualifier).Solution: Only perform the reverse transformation when the cabal library version is <= 3.0 and doesn't support the explicit syntax.
Now what happens in these two situations:
this is reinterpreted as
then printed and parsed exactly the same way.
Explicit syntax is parsed and printed without being munged (when supported)
Note: Mixins only supported sublibrary qualifiers from 3.4 whilst dependencies supported this from 3.0, hence the lack of guard on the mixins case.
Fixes #10283
Please read Github PR Conventions and then fill in one of these two templates.
Template Α: This PR modifies behaviour or interface
Include the following checklist in your PR:
Template B: This PR does not modify behaviour or interface
E.g. the PR only touches documentation or tests, does refactorings, etc.
Include the following checklist in your PR: