databricks / sjsonnet

Apache License 2.0
267 stars 55 forks source link

+: is erroneously interpreted as : within object comprehension #154

Closed NicholasHusin closed 1 year ago

NicholasHusin commented 2 years ago

Given the following:

{ ['foo']+: [x] for x in [1]} + { ['foo']+: [x] for x in [2]}

The official implementation of jsonnet would output:

{
  "foo": [
    1,
    2
  ]
}

due to the +: used.

However, on sjsonnet, the + in +: seems to be ignored, resulting in

{ ['foo']+: [x] for x in [1]} + { ['foo']+: [x] for x in [2]}

being interpreted as:

{ ['foo']: [x] for x in [1]} + { ['foo']: [x] for x in [2]}

and resulting in:

{
  "foo": [
    2
  ]
}

This causes an inconsistency between jsonnet and sjsonnet.

lihaoyi-databricks commented 1 year ago

Should be fixed by https://github.com/databricks/sjsonnet/pull/155