TristanCacqueray / dhall-openshift

Typecheck, template and modularize your OpenShift definitions with Dhall
Apache License 2.0
8 stars 0 forks source link

Problem with usage of "as" variable #4

Closed jfroche closed 4 years ago

jfroche commented 4 years ago

We face this problem with dhall-to-yaml 1.7.0 (coming from dhall-to-json) :

                      ↳ https://raw.githubusercontent.com/TristanCacqueray/dhall-openshift/v0.2.0/types/com.github.openshift.api.build.v1.ImageSource.dhall

Error: Invalid input

https://raw.githubusercontent.com/TristanCacqueray/dhall-openshift/v0.2.0/types/com.github.openshift.api.build.v1.ImageSource.dhall:2:5:
  |
2 | , as : Optional (List Text)
  |     ^
expecting any label or whitespace

https://github.com/TristanCacqueray/dhall-openshift/blob/master/types/com.github.openshift.api.build.v1.ImageSource.dhall#L2

Using dhall-to-yaml 1.6.1 (coming from dhall-to-json), we don't face the error.

Here is a simpler example:

test.dhall:

{ home       = "/home/bill"
, as = "/home/bill/.ssh/id_ed25519"
}

Using 1.7.0:

$ dhall-to-yaml --version
1.7.0
$ dhall-to-yaml --file test.dhall
Error: Invalid input

test.dhall:2:5:
  |
2 | , as = "/home/bill/.ssh/id_ed25519"
  |     ^
expecting any label or whitespace

Using 1.6.2:

$ /nix/store/rzdqbwwbbi01la1r0ki34hdjcw6fgvgl-dhall-json-1.6.2/bin/dhall-to-yaml --version
1.6.2
$ /nix/store/rzdqbwwbbi01la1r0ki34hdjcw6fgvgl-dhall-json-1.6.2/bin/dhall-to-yaml --file test.dhall
as: /home/bill/.ssh/id_ed25519
home: /home/bill

Is looks like a regression but are we supposed to use such keyword as variable name ? Maybe @gabriel439 has an opinion on this ?

TristanCacqueray commented 4 years ago

Thank you for the report. It seems like we now need to escape such keyword using backtick, like so:

{ home       = "/home/bill"
, `as` = "/home/bill/.ssh/id_ed25519"
}
jfroche commented 4 years ago

Thank you for your fast reply !