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

Remove "-any" from AnyVersion pretty-print output. #6741

Closed

Conversation

m-renaud
Copy link
Collaborator

@m-renaud m-renaud commented Apr 25, 2020

Behaviour Change

Old behaviour:

λ> pretty AnyVersion
-any

New behaviour:

λ> pretty AnyVersion

Testing

cabal run hackage-tests roundtrip

There is one failure in the Workflow package version 0.7.0.0 which uses the -any syntax (see Workflow.cabal) in addition to a version bound check: TCache -any && <1.0. Is this even valid? It would be equivalent to TCache <1.0.

TCache -any && <1.0
TCache && <1.0
       ^ Parse error

How would we go about fixing this @phadej ?

Also, let me know if there's other places you'd like to see updated, I just updates the pretty function as suggested in the other PR.

TODO

  • Fix lib-tests
  • Update changelog
  • Update docs

Please include the following checklist in your PR:

  • Patches conform to the coding conventions.
  • Any changes that could be relevant to users have been recorded in the changelog (add file to changelog.d directory).
  • The documentation has been updated, if necessary.

Please also shortly describe how you tested your change. Bonus points for added tests!

@m-renaud m-renaud requested a review from phadej April 25, 2020 23:05
@m-renaud
Copy link
Collaborator Author

Alright, @phadej as expected the round-trip property tests fail since print . parse "-any" does not equal "-any". Looking at the parsing code its not clear exactly how a lack of version range gets turned into the AnyVersion constructor, do you know how that happens? Is there a different parser for the version range other than what is in Cabal/Distribution/Types/VersionRange/Internal.hsCabal/Distribution/Types/VersionRange/Internal.hs ? The only place AnyVersion is constructed in the parser is here 😕

@phadej
Copy link
Collaborator

phadej commented Apr 26, 2020

See #6742

@phadej phadej closed this Apr 26, 2020
@@ -235,7 +235,7 @@ hyloVersionRange f g = h where h = f . fmap h . g
instance Pretty VersionRange where
pretty = fst . cataVersionRange alg
where
alg AnyVersionF = (Disp.text "-any", 0 :: Int)
alg AnyVersionF = (Disp.empty, 0 :: Int)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is wrong. The Dependency output have to be modified.

See what's done in #6742. That PR is not complete, I run out of time on Friday, so didn't put it up. Sorry for that. I changed the Dependency output as I was updating parser-tests outputs anyway.

@m-renaud m-renaud deleted the m-renaud-any-version-pretty-print branch April 26, 2020 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants