Function parameter defaults cannot depend on prior argument values, regression compared to other implementations
HT154 opened this issue · 0 comments
HT154 commented
local test = function(a, b=a.y) a.x + b;
[
test({x: 'x', y: 'y'}),
test({x: 'x', y: 'y'}, 'b'),
test({x: 'x'}, 'b'),
]
Results:
$ jsonnet test.jsonnet
[
"xy",
"xb",
"xb"
]
$ go-jsonnet test.jsonnet
[
"xy",
"xb",
"xb"
]
$ jrsonnet test.jsonnet
variable is not defined: a
/<path>/test.jsonnet:3:28-30: variable <a>
/<path>/test.jsonnet:3:39-41: variable <b>
/<path>/test.jsonnet:6:3-26 : function <test> call