This fails:
$ echo '{item:1,next:"b.sup"}' > a.sup &&
super -version &&
super -c '
const C = {a:1}
fn myfunc(u): ( [from f"{u}"][0] )
values {...myfunc("a.sup"), z:C}'
Version: v0.3.0-357-g0c71fac6a
cannot read data in constant expression at line 3, column 23:
fn myfunc(u): ( [from f"{u}"][0] )
~~~~~~
However if I swap the order of where the reference to the constant C appears in the call to values, it works.
$ super -c '
const C = {a:1}
fn myfunc(u): ( [from f"{u}"][0] )
values {z:C, ...myfunc("a.sup")}'
{z:{a:1},item:1,next:"b.sup"}
Details
Repro is with super commit 0c71fac.
The repro query above is a simplification of a query one of our advisors has been crafting. His query contained references to defined const values that were similarly referenced in calls to user-defined functions, and he was confused because it seemed like he could make the query fail/work by adding seemingly unrelated pipeline elements that happened to have the side effect of changing when the const resolution happens.
While getting Claude's help simplifying the repro query, it also offered its insight into the root cause and a possible approach for a fix, so this is available in a Gist.
This fails:
However if I swap the order of where the reference to the constant
Cappears in the call tovalues, it works.Details
Repro is with super commit 0c71fac.
The repro query above is a simplification of a query one of our advisors has been crafting. His query contained references to defined
constvalues that were similarly referenced in calls to user-defined functions, and he was confused because it seemed like he could make the query fail/work by adding seemingly unrelated pipeline elements that happened to have the side effect of changing when theconstresolution happens.While getting Claude's help simplifying the repro query, it also offered its insight into the root cause and a possible approach for a fix, so this is available in a Gist.