cue-lang / cue

The home of the CUE language! Validate and define text-based and dynamic configuration
https://cuelang.org
Apache License 2.0
5.08k stars 289 forks source link

evaluator: lists are comparable, disagreeing with the spec #2024

Open rogpeppe opened 1 year ago

rogpeppe commented 1 year ago

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

$ cue version
cue version v0.0.0-20221001181137-79d80efc2882

      -buildmode exe
       -compiler gc
     CGO_ENABLED 1
          GOARCH amd64
            GOOS linux
         GOAMD64 v1
             vcs git
    vcs.revision 79d80efc288208410f77d47ae9aedd37e106d84b
        vcs.time 2022-10-01T18:11:37Z
    vcs.modified false

Does this issue reproduce with the latest release?

Yes

What did you do?

! exec cue export test.cue

-- test.cue --
a: [0, 1]
b: [0, 1]
c: a == b

What did you expect to see?

The test should pass.

What did you see instead?

This failure:

> ! exec cue export test.cue
[stdout]
{
    "a": [
        0,
        1
    ],
    "b": [
        0,
        1
    ],
    "c": true
}
FAIL: /tmp/testscript178868958/x.txtar/script.txtar:1: unexpected command success

Given that the spec says that lists are not comparable:

Lists are not comparable.

I'd expect the comparison operator above to fail, but instead it does compare the lists.

mpvl commented 1 year ago

We are considering changing the spec to allow any concrete value to be comparable.