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

dhall format produces unparseable file when Some is used #2601

Open
winitzki opened this issue Aug 28, 2024 · 0 comments
Open

dhall format produces unparseable file when Some is used #2601

winitzki opened this issue Aug 28, 2024 · 0 comments

Comments

@winitzki
Copy link
Collaborator

winitzki commented Aug 28, 2024

The command dhall format removes backquotes when it thinks backquotes are unnecessary. But when backquotes are used for builtin labels like Some and Type, sometimes removing the backquotes produces incorrect code.

Minimal example:

let T = < Some | Type >
let t : T = T.`Some`
let x : T = T.`Type`
in True

Save this file as test.dhall.

$ dhall --file test.dhall
True
$ dhall format test.dhall
$ dhall --file test.dhall
dhall:
Error: Invalid input

test_formatter.dhall:5:8:
  |
5 |     = T.Some
  |        ^^

The file after formatting looks like this:

let T = < Some | Type >

let t
    : T
    = T.Some

let x
    : T
    = T.Type

in  True

The backquotes in Some and Type have been removed. This produces incorrect code that does not parse.

Expected behavior: Quotes should not be removed with Some. (It's fine to remove them for Type though.)

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

No branches or pull requests

1 participant