You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ cue version
cue version v0.0.0-20221216062120-45aa5c093e71
-compiler gc
CGO_ENABLED 1
GOARCH amd64
GOOS linux
GOAMD64 v1
vcs git
vcs.revision 45aa5c093e71660b341fa15a8a41d77eb64a0121
vcs.time 2022-12-16T06:21:20Z
vcs.modified false
Does this issue reproduce with the latest release?
Yes
What did you do?
! exec cue vet struct.cue
! exec cue vet numeric.cue
exec cue vet noncrete.cue
-- struct.cue --
import "list"
// Should fail.
list.UniqueItems & [{
b: 1
a: 0
}, {
a: 0
b: 1
}]
-- numeric.cue --
import "list"
// Should fail.
list.UniqueItems & [1.00, 1.0]
-- noncrete.cue --
import "list"
x: int
y: int
// Should succeed (x and y could become become different).
list.UniqueItems & [x, y]
What did you expect to see?
A passing test.
What did you see instead?
% testscript -continue /tmp/x.txtar
> ! exec cue vet struct.cue
FAIL: /tmp/testscript3815040590/x.txtar/script.txtar:1: unexpected command success
> ! exec cue vet numeric.cue
FAIL: /tmp/testscript3815040590/x.txtar/script.txtar:2: unexpected command success
> exec cue vet noncrete.cue
[stderr]
conflicting values list.UniqueItems() and {x:int,y:int,(list.UniqueItems & [x,y])} (mismatched types list and struct):
./noncrete.cue:1:1
The implementation of list.UniqueItems is overly simplistic. It should be fixed to respect equality (and perhaps we should define equality of objects as part of the CUE language specification).
What version of CUE are you using (
cue version
)?Does this issue reproduce with the latest release?
Yes
What did you do?
What did you expect to see?
A passing test.
What did you see instead?
The implementation of
list.UniqueItems
is overly simplistic. It should be fixed to respect equality (and perhaps we should define equality of objects as part of the CUE language specification).Note that jsonschema has a
uniqueItems
property, so it would probably be a good idea to align with that specification for the definition of equality: https://json-schema.org/draft/2020-12/json-schema-core.html#name-instance-equalityThe text was updated successfully, but these errors were encountered: