cue icon indicating copy to clipboard operation
cue copied to clipboard

evaluator: incompatible list element constraints not detected

Open myitcv opened this issue 1 year ago • 1 comments

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

$ cue version
cue version v0.0.0-20240712164527-719893f23850

go version go1.22.3
      -buildmode exe
       -compiler gc
  DefaultGODEBUG httplaxcontentlength=1,httpmuxgo121=1,tls10server=1,tlsrsakex=1,tlsunsafeekm=1
     CGO_ENABLED 1
          GOARCH arm64
            GOOS linux
             vcs git
    vcs.revision 719893f23850172d224720e6d1257586179ac895
        vcs.time 2024-07-12T16:45:27Z
    vcs.modified false
cue.lang.version v0.10.0

Does this issue reproduce with the latest release?

Yes

What did you do?

! exec cue vet x.cue
stderr 'incompatible list element types string and int'

-- x.cue --
x: [...string] & [...int]

What did you expect to see?

Passing test.

What did you see instead?

> ! exec cue vet x.cue
FAIL: /tmp/testscript22070679/repro.txtar/script.txtar:1: unexpected command success

i.e. there is currently no error as a result of this conjunction when there should be. Indeed it is impossible to produce anything other than an zero-element list with this construction.

Note that when we have fixed this issue we should also ensure that https://github.com/cue-lang/cue/issues/1654 is fixed.

myitcv avatar Jul 18 '24 06:07 myitcv

Theoretically this is not an error. It basically is an elaborate way of specifying that x must be the empty list.

I agree that vet could be stricter and give more useful user feedback, but as of now vet does not do that yet.

mpvl avatar Aug 12 '24 16:08 mpvl