databricks / sjsonnet

Apache License 2.0
266 stars 54 forks source link

`sjsonnet` accepts duplicate local variables whereas `jsonnet` doesn't #178

Open zapster opened 1 year ago

zapster commented 1 year ago

See the following jsonnet file:

$ cat duplicate_local.jsonnet
{
  local var = ['foo'],
  local var = var + ['bar'],
  var: var,
}

The jsonnet reference implementation complains:

$ jsonnet duplicate_local.jsonnet
duplicate_local.jsonnet:3:9-12 Duplicate local var: var

  local var = var + ['bar'],

However, sjsonnet happily accepts it:

$ sjsonnet duplicate_local.jsonnet
{
   "var": [
      "foo",
      "bar"
   ]
}

Independent of what makes more sense, I think sjsonnet should behave the same as jsonnet.

Jsonnet commandline interpreter v0.17.0 Sjsonnet 0.4.3