diff --git a/cue/testdata/builtins/validators.txtar b/cue/testdata/builtins/validators.txtar index 1f2a59bfab1..468669bded9 100644 --- a/cue/testdata/builtins/validators.txtar +++ b/cue/testdata/builtins/validators.txtar @@ -114,18 +114,41 @@ issue2098: incomplete1: { _a[0] } +-- issue3418.cue -- +issue3418: t1: "foo" & matchN(1, [1&2]) & matchN(1, [_]) +issue3418: t2: "foo" & matchN(1, [_]) & matchN(1, [1&2]) +issue3418: t3: { + x: "foo" + x: matchN(1, [_]) + x: matchN(1, [1&2]) +} +issue3418: t4: { + x: "foo" + x: matchN(1, [1&2]) + x: matchN(1, [_]) +} + -- out/eval/stats -- -Leaks: 0 -Freed: 50 -Reused: 45 -Allocs: 5 -Retain: 0 +Leaks: 4 +Freed: 73 +Reused: 67 +Allocs: 10 +Retain: 8 -Unifications: 50 -Conjuncts: 91 -Disjuncts: 52 +Unifications: 77 +Conjuncts: 146 +Disjuncts: 83 -- out/evalalpha -- Errors: +issue3418.0: conflicting values 2 and 1: + ./issue3418.cue:1:35 + ./issue3418.cue:1:37 +issue3418.t3.0: conflicting values 2 and 1: + ./issue3418.cue:6:16 + ./issue3418.cue:6:18 +issue3418.t4.0: conflicting values 2 and 1: + ./issue3418.cue:10:16 + ./issue3418.cue:10:18 callOfCallToValidator.e: cannot call previously called validator b: ./in.cue:94:5 @@ -224,12 +247,66 @@ Result: } } } + issue3418: (_|_){ + // [eval] + t1: (_|_){ + // [eval] issue3418.0: conflicting values 2 and 1: + // ./issue3418.cue:1:35 + // ./issue3418.cue:1:37 + } + t2: (_|_){ + // [eval] issue3418.0: conflicting values 2 and 1: + // ./issue3418.cue:2:52 + // ./issue3418.cue:2:54 + } + t3: (_|_){ + // [eval] + x: (_|_){ + // [eval] issue3418.t3.0: conflicting values 2 and 1: + // ./issue3418.cue:6:16 + // ./issue3418.cue:6:18 + } + } + t4: (_|_){ + // [eval] + x: (_|_){ + // [eval] issue3418.t4.0: conflicting values 2 and 1: + // ./issue3418.cue:10:16 + // ./issue3418.cue:10:18 + } + } + } } -- diff/-out/evalalpha<==>+out/eval -- diff old new --- old +++ new -@@ -20,7 +20,6 @@ +@@ -1,15 +1,15 @@ + Errors: ++issue3418.0: conflicting values 2 and 1: ++ ./issue3418.cue:1:35 ++ ./issue3418.cue:1:37 ++issue3418.t3.0: conflicting values 2 and 1: ++ ./issue3418.cue:6:16 ++ ./issue3418.cue:6:18 ++issue3418.t4.0: conflicting values 2 and 1: ++ ./issue3418.cue:10:16 ++ ./issue3418.cue:10:18 + callOfCallToValidator.e: cannot call previously called validator b: + ./in.cue:94:5 +-issue3418.t2: invalid value "foo" (does not satisfy matchN(1, _|_(issue3418.0: conflicting values 2 and 1))): 0 matched, expected 1: +- ./issue3418.cue:2:41 +- ./issue3418.cue:2:16 +- ./issue3418.cue:2:48 +-issue3418.t3.x: invalid value "foo" (does not satisfy matchN(1, _|_(issue3418.t3.0: conflicting values 2 and 1))): 0 matched, expected 1: +- ./issue3418.cue:6:5 +- ./issue3418.cue:4:5 +- ./issue3418.cue:5:5 +- ./issue3418.cue:6:12 + + Result: + (_|_){ +@@ -29,7 +29,6 @@ kv: (_|_){ // [incomplete] incompleteError2.MyType.kv: invalid value {} (does not satisfy struct.MinFields(1)): len(fields) < MinFields(1) (0 < 1): // ./in.cue:22:7 @@ -237,7 +314,7 @@ diff old new // ./in.cue:22:24 } } -@@ -44,7 +43,6 @@ +@@ -53,7 +52,6 @@ kv: (_|_){ // [incomplete] violation.#MyType.kv: invalid value {} (does not satisfy struct.MinFields(1)): len(fields) < MinFields(1) (0 < 1): // ./in.cue:49:7 @@ -245,7 +322,7 @@ diff old new // ./in.cue:49:24 } } -@@ -91,15 +89,10 @@ +@@ -100,15 +98,10 @@ 0: (int){ 1 } } } @@ -262,12 +339,67 @@ diff old new // ./in.cue:112:20 } } +@@ -115,25 +108,31 @@ + } + issue3418: (_|_){ + // [eval] +- t1: (string){ "foo" } ++ t1: (_|_){ ++ // [eval] issue3418.0: conflicting values 2 and 1: ++ // ./issue3418.cue:1:35 ++ // ./issue3418.cue:1:37 ++ } + t2: (_|_){ +- // [eval] issue3418.t2: invalid value "foo" (does not satisfy matchN(1, _|_(issue3418.0: conflicting values 2 and 1))): 0 matched, expected 1: +- // ./issue3418.cue:2:41 +- // ./issue3418.cue:2:16 +- // ./issue3418.cue:2:48 ++ // [eval] issue3418.0: conflicting values 2 and 1: ++ // ./issue3418.cue:2:52 ++ // ./issue3418.cue:2:54 + } + t3: (_|_){ + // [eval] + x: (_|_){ +- // [eval] issue3418.t3.x: invalid value "foo" (does not satisfy matchN(1, _|_(issue3418.t3.0: conflicting values 2 and 1))): 0 matched, expected 1: +- // ./issue3418.cue:6:5 +- // ./issue3418.cue:4:5 +- // ./issue3418.cue:5:5 +- // ./issue3418.cue:6:12 +- } +- } +- t4: (struct){ +- x: (string){ "foo" } ++ // [eval] issue3418.t3.0: conflicting values 2 and 1: ++ // ./issue3418.cue:6:16 ++ // ./issue3418.cue:6:18 ++ } ++ } ++ t4: (_|_){ ++ // [eval] ++ x: (_|_){ ++ // [eval] issue3418.t4.0: conflicting values 2 and 1: ++ // ./issue3418.cue:10:16 ++ // ./issue3418.cue:10:18 ++ } + } + } + } -- diff/todo/p2 -- Missing error at incomplete1: index 0 is erased. -- out/eval -- Errors: callOfCallToValidator.e: cannot call previously called validator b: ./in.cue:94:5 +issue3418.t2: invalid value "foo" (does not satisfy matchN(1, _|_(issue3418.0: conflicting values 2 and 1))): 0 matched, expected 1: + ./issue3418.cue:2:41 + ./issue3418.cue:2:16 + ./issue3418.cue:2:48 +issue3418.t3.x: invalid value "foo" (does not satisfy matchN(1, _|_(issue3418.t3.0: conflicting values 2 and 1))): 0 matched, expected 1: + ./issue3418.cue:6:5 + ./issue3418.cue:4:5 + ./issue3418.cue:5:5 + ./issue3418.cue:6:12 Result: (_|_){ @@ -371,6 +503,29 @@ Result: } } } + issue3418: (_|_){ + // [eval] + t1: (string){ "foo" } + t2: (_|_){ + // [eval] issue3418.t2: invalid value "foo" (does not satisfy matchN(1, _|_(issue3418.0: conflicting values 2 and 1))): 0 matched, expected 1: + // ./issue3418.cue:2:41 + // ./issue3418.cue:2:16 + // ./issue3418.cue:2:48 + } + t3: (_|_){ + // [eval] + x: (_|_){ + // [eval] issue3418.t3.x: invalid value "foo" (does not satisfy matchN(1, _|_(issue3418.t3.0: conflicting values 2 and 1))): 0 matched, expected 1: + // ./issue3418.cue:6:5 + // ./issue3418.cue:4:5 + // ./issue3418.cue:5:5 + // ./issue3418.cue:6:12 + } + } + t4: (struct){ + x: (string){ "foo" } + } + } } -- out/compile -- --- in.cue @@ -478,3 +633,42 @@ Result: } } } +--- issue3418.cue +{ + issue3418: { + t1: (("foo" & matchN(1, [ + (1 & 2), + ])) & matchN(1, [ + _, + ])) + } + issue3418: { + t2: (("foo" & matchN(1, [ + _, + ])) & matchN(1, [ + (1 & 2), + ])) + } + issue3418: { + t3: { + x: "foo" + x: matchN(1, [ + _, + ]) + x: matchN(1, [ + (1 & 2), + ]) + } + } + issue3418: { + t4: { + x: "foo" + x: matchN(1, [ + (1 & 2), + ]) + x: matchN(1, [ + _, + ]) + } + } +}