github.com/solo-io/cue@v0.4.7/cue/testdata/comprehensions/errors.txtar (about) 1 -- in.cue -- 2 circularIf: { 3 #list: { 4 tail: #list | *null 5 if tail != null { 6 } 7 } 8 } 9 10 circularFor: { 11 #list: { 12 tail: #list | *null 13 for x in tail != null { 14 } 15 } 16 } 17 18 // Print a bit more sensible error message than "empty disjunction" here. 19 // Issue #465 20 userError: { 21 a: string | *_|_ 22 if a != "" { 23 } 24 } 25 -- out/eval -- 26 Errors: 27 circularFor.#list: invalid operand tail != null (found bool, want list or struct): 28 ./in.cue:12:18 29 30 Result: 31 (_|_){ 32 // [eval] 33 circularIf: (struct){ 34 #list: (#struct){ 35 tail: ((null|struct)){ |(*(null){ null }, (#struct){ 36 tail: (null){ null } 37 }) } 38 } 39 } 40 circularFor: (_|_){ 41 // [eval] 42 #list: (_|_){ 43 // [eval] circularFor.#list: invalid operand tail != null (found bool, want list or struct): 44 // ./in.cue:12:18 45 tail: (null){ null } 46 } 47 } 48 userError: (_|_){ 49 // [incomplete] userError: non-concrete value string in operand to !=: 50 // ./in.cue:21:8 51 // ./in.cue:20:5 52 a: (string){ string } 53 } 54 } 55 -- out/compile -- 56 --- in.cue 57 { 58 circularIf: { 59 #list: { 60 tail: (〈1;#list〉|*null) 61 if (〈0;tail〉 != null) {} 62 } 63 } 64 circularFor: { 65 #list: { 66 tail: (〈1;#list〉|*null) 67 for _, x in (〈0;tail〉 != null) {} 68 } 69 } 70 userError: { 71 a: (string|*_|_(explicit error (_|_ literal) in source)) 72 if (〈0;a〉 != "") {} 73 } 74 }