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

Parse error on "mixins" field #5150

Open
pikajude opened this Issue Feb 15, 2018 · 6 comments

Comments

Projects
None yet
4 participants
@pikajude

pikajude commented Feb 15, 2018

The mixins field doesn't parse if the provided renaming clause has whitespace after the opening parenthesis.

mixins: example-mixin ( Mixin1 as Foo.Mixin1
                      , Mixin2 as Foo.Mixin2
                      )
$ readGenericPackageDescription normal "test.txt"
Warning: test.txt:6:26:
unexpected " "
expecting ")"

example-mixin ( Mixin1 as Foo.Mixin1
, Mixin2 as Foo.Mixin2
)
*** Exception: dieVerbatim: user error (<interactive>: Failed parsing "test.txt".

If I delete the space in ( Mixin1 it parses fine. I feel like the given example should parse correctly since it would make vertically formatted long renaming clauses nicer-looking.

If this isn't intended behavior, I can PR the patch I've made locally.

@phadej

This comment has been minimized.

Collaborator

phadej commented Feb 15, 2018

@pikajude

This comment has been minimized.

pikajude commented Feb 15, 2018

$ cabal --version && cabal check
cabal-install version 2.0.0.1
compiled using version 2.0.1.0 of the Cabal library
cabal: ./test.cabal:6: Parse of field 'mixins' failed.
@phadej

This comment has been minimized.

Collaborator

phadej commented Feb 15, 2018

@pikajude

This comment has been minimized.

pikajude commented Feb 15, 2018

Which version of Cabal is supposed to be able to parse my example? If I specify cabal-version: 2.2 at the top of the file, the parse error still happens, and 2.3 isn't a supported version.

@ezyang

This comment has been minimized.

Contributor

ezyang commented Feb 16, 2018

Sorry, what @phadej was saying that it's not enough to just fix the parser, we also have to make sure the fix only applies when you have a sufficiently new cabal-version (probably 2.4 since we've missed this merge Window.)

@phadej, is this really necessary? It's certainly not a BC-breaking change, which is what I thought cabal-version was for.

@phadej

This comment has been minimized.

Collaborator

phadej commented Feb 16, 2018

@ezyang It's breaking change. If there will be a .cabal file requiring relaxed parser and cabal-version: 2.0, it will break cabal-install-2.0 as example above shows.

Similar "small" thing as #5092 #5093 #5138 (EDIT removed wrong issue from the list)

danidiaz pushed a commit to danidiaz/cabal that referenced this issue Jun 18, 2018

daniel
Added note to the documentation of "mixins:"
It mentions the issue of parsing failures caused by the presence of
blank spaces after opening parentheses.

See haskell#5150, haskell#5292, haskell#5293.

23Skidoo added a commit that referenced this issue Jun 19, 2018

Added note to the documentation of "mixins:"
It mentions the issue of parsing failures caused by the presence of
blank spaces after opening parentheses.

See #5150, #5292, #5293.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment