-
Notifications
You must be signed in to change notification settings - Fork 697
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
Hackage roundtrip tests are failing for package io-classes
due to dependency splitting
#10283
Comments
The error is introduced by this function
|
Setting the |
Linked to #6083 |
Minimised reproducer:
|
It seems a bit baffling to me that |
…cit 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.. ``` library build-depends: foo library foo ... ``` this is reinterpreted as ``` library build-depends: mylib:foo library foo ... ``` * In `preProcessInternalDeps` the inverse transformation takes place, the goal is to replace `mylib:foo` with just `foo`. * Things go wrong if you are using version 3.0 for your cabal file because - In 3.0 the qualifier syntax is introduced so you can be expliciit about sublibrary dependencies - The shadowing semantics of non-qualified dependencies still exists. So the situation is that the user is explicit about the sublibrary ``` library library qux build-depends: mylib:{mylib, foo} library foo ``` 1. Post-process leaves this alone, the user is already explicit about depending on a sublibrary. 2. Pre-processing then rewrites `mylib:{mylib, foo}` into two dependencies, `mylib` and `foo` (no qualifier). 3. When parsed these are two separate dependencies rather than treated as one dependency, roundtrip test fails. 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: 1. ``` library build-depends: foo library foo ... ``` this is reinterpreted as ``` library build-depends: mylib:foo library foo ... ``` then printed and parsed exactly the same way. 2. 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
…cit 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.. ``` library build-depends: foo library foo ... ``` this is reinterpreted as ``` library build-depends: mylib:foo library foo ... ``` * In `preProcessInternalDeps` the inverse transformation takes place, the goal is to replace `mylib:foo` with just `foo`. * Things go wrong if you are using version 3.0 for your cabal file because - In 3.0 the qualifier syntax is introduced so you can be expliciit about sublibrary dependencies - The shadowing semantics of non-qualified dependencies still exists. So the situation is that the user is explicit about the sublibrary ``` library library qux build-depends: mylib:{mylib, foo} library foo ``` 1. Post-process leaves this alone, the user is already explicit about depending on a sublibrary. 2. Pre-processing then rewrites `mylib:{mylib, foo}` into two dependencies, `mylib` and `foo` (no qualifier). 3. When parsed these are two separate dependencies rather than treated as one dependency, roundtrip test fails. 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: 1. ``` library build-depends: foo library foo ... ``` this is reinterpreted as ``` library build-depends: mylib:foo library foo ... ``` then printed and parsed exactly the same way. 2. 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
…cit 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.. ``` library build-depends: foo library foo ... ``` this is reinterpreted as ``` library build-depends: mylib:foo library foo ... ``` * In `preProcessInternalDeps` the inverse transformation takes place, the goal is to replace `mylib:foo` with just `foo`. * Things go wrong if you are using version 3.0 for your cabal file because - In 3.0 the qualifier syntax is introduced so you can be expliciit about sublibrary dependencies - The shadowing semantics of non-qualified dependencies still exists. So the situation is that the user is explicit about the sublibrary ``` library library qux build-depends: mylib:{mylib, foo} library foo ``` 1. Post-process leaves this alone, the user is already explicit about depending on a sublibrary. 2. Pre-processing then rewrites `mylib:{mylib, foo}` into two dependencies, `mylib` and `foo` (no qualifier). 3. When parsed these are two separate dependencies rather than treated as one dependency, roundtrip test fails. 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: 1. ``` library build-depends: foo library foo ... ``` this is reinterpreted as ``` library build-depends: mylib:foo library foo ... ``` then printed and parsed exactly the same way. 2. 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
Do you want me to publish a revision which is using |
@coot At this point it doesn't matter what you do as the cabal file which exposes the bug is in the index tarball and will never be deleted. (Not a problem, it was a real bug which was exposed by the package) |
…cit 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.. ``` library build-depends: foo library foo ... ``` this is reinterpreted as ``` library build-depends: mylib:foo library foo ... ``` * In `preProcessInternalDeps` the inverse transformation takes place, the goal is to replace `mylib:foo` with just `foo`. * Things go wrong if you are using version 3.0 for your cabal file because - In 3.0 the qualifier syntax is introduced so you can be expliciit about sublibrary dependencies - The shadowing semantics of non-qualified dependencies still exists. So the situation is that the user is explicit about the sublibrary ``` library library qux build-depends: mylib:{mylib, foo} library foo ``` 1. Post-process leaves this alone, the user is already explicit about depending on a sublibrary. 2. Pre-processing then rewrites `mylib:{mylib, foo}` into two dependencies, `mylib` and `foo` (no qualifier). 3. When parsed these are two separate dependencies rather than treated as one dependency, roundtrip test fails. 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: 1. ``` library build-depends: foo library foo ... ``` this is reinterpreted as ``` library build-depends: mylib:foo library foo ... ``` then printed and parsed exactly the same way. 2. 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
…cit 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.. ``` library build-depends: foo library foo ... ``` this is reinterpreted as ``` library build-depends: mylib:foo library foo ... ``` * In `preProcessInternalDeps` the inverse transformation takes place, the goal is to replace `mylib:foo` with just `foo`. * Things go wrong if you are using version 3.0 for your cabal file because - In 3.0 the qualifier syntax is introduced so you can be expliciit about sublibrary dependencies - The shadowing semantics of non-qualified dependencies still exists. So the situation is that the user is explicit about the sublibrary ``` library library qux build-depends: mylib:{mylib, foo} library foo ``` 1. Post-process leaves this alone, the user is already explicit about depending on a sublibrary. 2. Pre-processing then rewrites `mylib:{mylib, foo}` into two dependencies, `mylib` and `foo` (no qualifier). 3. When parsed these are two separate dependencies rather than treated as one dependency, roundtrip test fails. 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: 1. ``` library build-depends: foo library foo ... ``` this is reinterpreted as ``` library build-depends: mylib:foo library foo ... ``` then printed and parsed exactly the same way. 2. 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
Originally posted by @mpickering in #10277 (comment)
The text was updated successfully, but these errors were encountered: