Open jpluscplusm opened 3 weeks ago
Thanks for the report, @jpluscplusm.
If you will allow me, I think the repro is clearer like this:
! exec cue vet
cmp stderr stderr.golden
-- f.cue --
package p
A: 42
A: matchN(0, [int])
A: matchN(0, [string, number])
A: matchN(0, [42, >100, >1000])
B: 42
B: matchN(1, [int, >10])
B: matchN(1, [string, >100])
-- stderr.golden --
A: invalid value 42 (does not satisfy matchN(0, [int])): 1 matched, expected 0:
./f.cue:4:4
./f.cue:3:4
./f.cue:4:11
./f.cue:5:4
./f.cue:6:4
A: invalid value 42 (does not satisfy matchN(0, [string,number])): 1 matched, expected 0:
./f.cue:5:4
./f.cue:3:4
./f.cue:4:4
./f.cue:5:11
./f.cue:6:4
A: invalid value 42 (does not satisfy matchN(0, [42,>100,>1000])): 1 matched, expected 0:
./f.cue:6:4
./f.cue:3:4
./f.cue:4:4
./f.cue:5:4
./f.cue:6:11
B: invalid value 42 (does not satisfy matchN(1, [int,>10])): 2 matched, expected 1:
./f.cue:9:4
./f.cue:8:4
./f.cue:9:11
B: invalid value 42 (does not satisfy matchN(1, [string,>100])): 0 matched, expected 1:
./f.cue:10:4
./f.cue:8:4
./f.cue:9:4
./f.cue:10:11
Expectation is that it should pass but we get:
> cmp stderr stderr.golden
diff stderr stderr.golden
--- stderr
+++ stderr.golden
@@ -16,6 +16,10 @@
./f.cue:4:4
./f.cue:5:4
./f.cue:6:11
+B: invalid value 42 (does not satisfy matchN(1, [int,>10])): 2 matched, expected 1:
+ ./f.cue:9:4
+ ./f.cue:8:4
+ ./f.cue:9:11
B: invalid value 42 (does not satisfy matchN(1, [string,>100])): 0 matched, expected 1:
./f.cue:10:4
./f.cue:8:4
FAIL: /tmp/testscript2903460784/repro.txtar/script.txtar:2: stderr and stderr.golden differ
Observation: v3 does the right thing here.
What version of CUE are you using (
cue version
)?Does this issue reproduce with the latest stable release?
n/a (function is not available in latest, v0.10.0)
What did you do?
Repro from @myitcv in https://github.com/cue-lang/cue/issues/3388#issuecomment-2304204638
What did you expect to see?
A passing test.
What did you see instead?