Skip to content

dhall format produces unparseable file when Some is used #2601

@winitzki

Description

@winitzki

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.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions