Skip to content

record puns parsing error #1732

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

Closed
amesgen opened this issue Mar 31, 2020 · 9 comments · Fixed by #1733
Closed

record puns parsing error #1732

amesgen opened this issue Mar 31, 2020 · 9 comments · Fixed by #1733
Assignees

Comments

@amesgen
Copy link
Contributor

amesgen commented Mar 31, 2020

I find this surprising:

$ dhall <<< "let x = 0 in { x, a = 0 }"
{ X = 1, Y = 2, a = 0 }
$ dhall <<< "let x = 0 in { x , a = 0 }"
dhall: 
Error: Invalid input

(stdin):1:18:
  |
1 | let x = 0 in { x , a = 0 }
  |                  ^
unexpected ','
expecting whitespace or }

dhall-rust accepts both inputs (clone https://github.com/amesgen/stuff and run cargo run in branch dhall-puns-repro).

@sjakobi sjakobi self-assigned this Mar 31, 2020
@amesgen
Copy link
Contributor Author

amesgen commented Mar 31, 2020

Maybe here

as <- Text.Megaparsec.sepBy1 keysValue (_comma *> whitespace)

to

as <- Text.Megaparsec.sepBy1 keysValue (whitespace *> _comma *> whitespace)

seems to fix it.

@sjakobi
Copy link
Collaborator

sjakobi commented Mar 31, 2020

Many thanks for the report @amesgen. I've pushed a fix to #1733. Your solution might also work though – I'm not sure.

@amesgen
Copy link
Contributor Author

amesgen commented Mar 31, 2020

Thanks for the very quick fix! I can't run the test suite as I am on 8.8.3 (--allow-newer worked) and I get errors like

     error: missing binary operator before token "("
       38 | #if MIN_VERSION_http_client(0,5,0)
          | 
   |
38 | #if MIN_VERSION_http_client(0,5,0)
   | ^

(but this is completely unrelate to this issue)

@sjakobi
Copy link
Collaborator

sjakobi commented Mar 31, 2020

@amesgen Here's some info regarding the doctest issue: #1700 (comment) (Actually we have a whole issue for that: #1100)

Developing with 8.8 should be properly supported soon: #1249

@amesgen
Copy link
Contributor Author

amesgen commented Mar 31, 2020

Ah interesting, seems like a very annoying issue. Thanks!

@Gabriella439
Copy link
Collaborator

@amesgen: Also, you can skip the doctests and selectively run the remaining tests using cabal test tasty

@amesgen
Copy link
Contributor Author

amesgen commented Mar 31, 2020

Hmm, cabal test --allow-newer tasty results in

Running 1 test suites...
Test suite tasty: RUNNING...
tasty: ./dhall-lang/tests/normalization/success: getPermissions:getFileStatus: does not exist (No such file or directory)
Test suite tasty: FAIL

(feel free to ignore this)

@sjakobi
Copy link
Collaborator

sjakobi commented Mar 31, 2020

@amesgen Did you git submodule update --init?

@amesgen
Copy link
Contributor Author

amesgen commented Mar 31, 2020

Ah sry, that was it! My fix above does not work, good to know!

https://gist.github.com/amesgen/60ac5ab3884dc277de4da78fe1580637

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.

3 participants