cue
cue copied to clipboard
list: Contains does not seem to work with list elements using defaults
What version of CUE are you using (cue version)?
0.13.0
Does this issue reproduce with the latest stable release?
Yes
What did you do?
list.Contains does not work as expected.
import "list"
out: list.Contains(["no", "no"|*"yes"], "yes")
out2: list.Contains([true | *false], false)
Cue playground : https://cuelang.org/play/?id=aE5_fWvAw-N#w=function&i=cue&f=export&o=cue
What did you expect to see?
I expected to see both True for examples above
What did you see instead?
Both values are false.
In the form of a testscript:
# evalv2
env CUE_EXPERIMENT=evalv3=0
exec cue export in.cue
# evalv3
env CUE_EXPERIMENT=evalv3=1
exec cue export in.cue
-- in.cue --
import "list"
out: list.Contains(["no", "no"|*"yes"], "yes")
As of e1fd269e50e91dc9879aace3c5388a10cc7bc24f:
# evalv2 (0.015s)
> env CUE_EXPERIMENT=evalv3=0
> exec cue export in.cue
[stdout]
{
"out": false
}
# evalv3 (0.013s)
> env CUE_EXPERIMENT=evalv3=1
> exec cue export in.cue
[stdout]
{
"out": false
}
PASS
I would expect out: true as the result here, and @mpvl agrees. It's worth noting that this is not an evalv3 regression, as evalv2 also gives the same result, and I went as far back as v0.10.0 and v0.4.3, and I still got the same results there.