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

Parse error on "mixins" field #5150

Closed
pikajude opened this issue Feb 15, 2018 · 7 comments · Fixed by #5514
Closed

Parse error on "mixins" field #5150

pikajude opened this issue Feb 15, 2018 · 7 comments · Fixed by #5514

Comments

@pikajude
Copy link

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
Copy link
Collaborator

phadej commented Feb 15, 2018 via email

@pikajude
Copy link
Author

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
Copy link
Collaborator

phadej commented Feb 15, 2018 via email

@pikajude
Copy link
Author

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
Copy link
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
Copy link
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
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 pushed a commit that referenced this issue Jun 19, 2018
It mentions the issue of parsing failures caused by the presence of
blank spaces after opening parentheses.

See #5150, #5292, #5293.
@fgaz
Copy link
Member

fgaz commented Feb 15, 2021

Was this fixed in #5293 ?

@fgaz fgaz linked a pull request Feb 15, 2021 that will close this issue
@fgaz fgaz closed this as completed Feb 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants