| -- in.cue -- |
| circularIf: { |
| #list: { |
| tail: #list | *null |
| if tail != null { |
| } |
| } |
| } |
| |
| circularFor: { |
| #list: { |
| tail: #list | *null |
| for x in tail != null { |
| } |
| } |
| } |
| |
| // Print a bit more sensible error message than "empty disjunction" here. |
| // Issue #465 |
| userError: { |
| a: string | *_|_ |
| if a != "" { |
| } |
| } |
| -- out/eval -- |
| Errors: |
| circularFor.#list: invalid operand tail != null (found bool, want list or struct): |
| ./in.cue:12:18 |
| |
| Result: |
| (_|_){ |
| // [eval] |
| circularIf: (struct){ |
| #list: (#struct){ |
| tail: ((null|struct)){ |(*(null){ null }, (#struct){ |
| tail: (null){ null } |
| }) } |
| } |
| } |
| circularFor: (_|_){ |
| // [eval] |
| #list: (_|_){ |
| // [eval] circularFor.#list: invalid operand tail != null (found bool, want list or struct): |
| // ./in.cue:12:18 |
| tail: (null){ null } |
| } |
| } |
| userError: (_|_){ |
| // [incomplete] userError: non-concrete value string in operand to !=: |
| // ./in.cue:21:8 |
| // ./in.cue:20:5 |
| a: (string){ string } |
| } |
| } |
| -- out/compile -- |
| --- in.cue |
| { |
| circularIf: { |
| #list: { |
| tail: (〈1;#list〉|*null) |
| if (〈0;tail〉 != null) {} |
| } |
| } |
| circularFor: { |
| #list: { |
| tail: (〈1;#list〉|*null) |
| for _, x in (〈0;tail〉 != null) {} |
| } |
| } |
| userError: { |
| a: (string|*_|_(explicit error (_|_ literal) in source)) |
| if (〈0;a〉 != "") {} |
| } |
| } |