Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg/list: UniqueItems validation breaks when used on a hidden list of structs next to an embedded value #3652

Open
jpluscplusm opened this issue Jan 3, 2025 · 1 comment

Comments

@jpluscplusm
Copy link
Collaborator

jpluscplusm commented Jan 3, 2025

What version of CUE are you using (cue version)?

$ cue version
cue version v0.12.0-alpha.1.0.20250103115825-74a0c9d01e05

go version go1.23.0
      -buildmode exe
       -compiler gc
  DefaultGODEBUG asynctimerchan=1,gotypesalias=0,httpservecontentkeepheaders=1,tls3des=1,tlskyber=0,x509keypairleaf=0,x509negativeserial=1
     CGO_ENABLED 1
          GOARCH amd64
            GOOS linux
         GOAMD64 v1
cue.lang.version v0.12.0

Does this issue reproduce with the latest stable release?

No; the repro passes with v0.11.1 (modulo a slightly different validation error message).

What did you do?

! exec cue vet -c working.cue
cmp stderr out.working

! exec cue vet -c broken.cue

-- working.cue --
import "list"

A: [1, 1]
B: {
	42
	_check: list.UniqueItems & A
}
-- broken.cue --
import "list"

A: [{a: 1}, {a: 1}]
B: {
	42
	_check: list.UniqueItems & A
}
-- out.working --
B._check: invalid value [1,1] (does not satisfy list.UniqueItems): equal value (1) at position 0 and 1:
    ./working.cue:6:10

What did you expect to see?

A passing test.

What did you see instead?

> ! exec cue vet -c working.cue
[stderr]
B._check: invalid value [1,1] (does not satisfy list.UniqueItems): equal value (1) at position 0 and 1:
    ./working.cue:6:10
[exit status 1]
> cmp stderr out.working
> ! exec cue vet -c broken.cue
FAIL: /tmp/testscript4225105853/list.uniqueitems.txtar/script.txtar:4: unexpected command success
@myitcv myitcv changed the title list/UniqueItems: validation breaks when used on a hidden list of structs next to an embedded value pkg/list: UniqueItems validation breaks when used on a hidden list of structs next to an embedded value Jan 3, 2025
@jpluscplusm
Copy link
Collaborator Author

This form is being used as the basis of a rewrite of some cuelang.org content. This regression (post https://cuelang.org/cl/1204378) is blocking https://cuelang.org/cl/1206577.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant