cue icon indicating copy to clipboard operation
cue copied to clipboard

pkg/list: MatchN does not match in final mode

Open rogpeppe opened this issue 1 year ago • 0 comments

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

$ cue version
16986b2c451c93c6f57d6d48ab570e59cd7782a3

Does this issue reproduce with the latest stable release?

N/A (list.MatchN isn't present in v0.10.0)

What did you do?

! exec cue vet -c list.cue

-- list.cue --
import "list"

a: [{}]
a: list.MatchN(1, {a!: _})

What did you expect to see?

Passing test. The list.MatchN argument should require at least one member in the list that has an a field.

What did you see instead?

> ! exec cue vet -c list.cue
FAIL: y.txtar:1: unexpected command success

It seems that the list.MatchN logic should evaluate in final mode and follow some of the same logic used by the matchN builtin for determining whether to give an incomplete or a permanent error.

rogpeppe avatar Oct 17 '24 15:10 rogpeppe