github.com/solo-io/cue@v0.4.7/cue/testdata/disjunctions/errors.txtar (about)

     1  -- in.cue --
     2  issue570: {
     3      results: #DecodeOutput
     4      results: result: "hello"
     5  
     6      #Output: {
     7          result: _
     8      } | {
     9          error: string
    10      }
    11  
    12      #DecodeOutput: #Output & {
    13          result?: [... string]
    14          ...
    15      }
    16  }
    17  
    18  issue516: {
    19      #Def: {
    20          match: metrics: string: {}
    21      } | {}
    22  
    23      x: #Def
    24      x: match: metrics: "foo": {}
    25  }
    26  
    27  // issue #465
    28  explicitDefaultError: {
    29      a: string | *_|_
    30  
    31      if a != "" {
    32      }
    33  }
    34  
    35  -- out/eval --
    36  Errors:
    37  issue516.x: 2 errors in empty disjunction:
    38  issue516.x: field not allowed: match:
    39      ./in.cue:20:9
    40      ./in.cue:22:8
    41      ./in.cue:23:8
    42  issue516.x.match.metrics: field not allowed: foo:
    43      ./in.cue:19:25
    44      ./in.cue:22:8
    45      ./in.cue:23:24
    46  issue570.results: 2 errors in empty disjunction:
    47  issue570.results: field not allowed: result:
    48      ./in.cue:2:14
    49      ./in.cue:3:14
    50      ./in.cue:7:9
    51      ./in.cue:11:20
    52      ./in.cue:12:9
    53  issue570.results.result: conflicting values "hello" and [...string] (mismatched types string and list):
    54      ./in.cue:2:14
    55      ./in.cue:3:22
    56      ./in.cue:12:18
    57  
    58  Result:
    59  (_|_){
    60    // [eval]
    61    issue570: (_|_){
    62      // [eval]
    63      results: (_|_){
    64        // [eval] issue570.results: 2 errors in empty disjunction:
    65        // issue570.results: field not allowed: result:
    66        //     ./in.cue:2:14
    67        //     ./in.cue:3:14
    68        //     ./in.cue:7:9
    69        //     ./in.cue:11:20
    70        //     ./in.cue:12:9
    71        // issue570.results.result: conflicting values "hello" and [...string] (mismatched types string and list):
    72        //     ./in.cue:2:14
    73        //     ./in.cue:3:22
    74        //     ./in.cue:12:18
    75        result: (_|_){
    76          // [eval] issue570.results: field not allowed: result:
    77          //     ./in.cue:2:14
    78          //     ./in.cue:3:14
    79          //     ./in.cue:7:9
    80          //     ./in.cue:11:20
    81          //     ./in.cue:12:9
    82        }
    83        error: (string){ string }
    84      }
    85      #Output: (#struct){ |((#struct){
    86          result: (_){ _ }
    87        }, (#struct){
    88          error: (string){ string }
    89        }) }
    90      #DecodeOutput: (#struct){ |((#struct){
    91          result: (list){
    92          }
    93        }, (#struct){
    94          error: (string){ string }
    95        }) }
    96    }
    97    issue516: (_|_){
    98      // [eval]
    99      #Def: (#struct){ |((#struct){
   100          match: (#struct){
   101            metrics: (#struct){
   102              string: (#struct){
   103              }
   104            }
   105          }
   106        }, (#struct){
   107        }) }
   108      x: (_|_){
   109        // [eval] issue516.x: 2 errors in empty disjunction:
   110        // issue516.x: field not allowed: match:
   111        //     ./in.cue:20:9
   112        //     ./in.cue:22:8
   113        //     ./in.cue:23:8
   114        // issue516.x.match.metrics: field not allowed: foo:
   115        //     ./in.cue:19:25
   116        //     ./in.cue:22:8
   117        //     ./in.cue:23:24
   118        match: (_|_){
   119          // [eval] issue516.x: field not allowed: match:
   120          //     ./in.cue:20:9
   121          //     ./in.cue:22:8
   122          //     ./in.cue:23:8
   123        }
   124      }
   125    }
   126    explicitDefaultError: (_|_){
   127      // [incomplete] explicitDefaultError: non-concrete value string in operand to !=:
   128      //     ./in.cue:30:8
   129      //     ./in.cue:28:5
   130      a: (string){ string }
   131    }
   132  }
   133  -- out/compile --
   134  --- in.cue
   135  {
   136    issue570: {
   137      results: 〈0;#DecodeOutput〉
   138      results: {
   139        result: "hello"
   140      }
   141      #Output: ({
   142        result: _
   143      }|{
   144        error: string
   145      })
   146      #DecodeOutput: (〈0;#Output〉 & {
   147        result?: [
   148          ...string,
   149        ]
   150        ...
   151      })
   152    }
   153    issue516: {
   154      #Def: ({
   155        match: {
   156          metrics: {
   157            string: {}
   158          }
   159        }
   160      }|{})
   161      x: 〈0;#Def〉
   162      x: {
   163        match: {
   164          metrics: {
   165            foo: {}
   166          }
   167        }
   168      }
   169    }
   170    explicitDefaultError: {
   171      a: (string|*_|_(explicit error (_|_ literal) in source))
   172      if (〈0;a〉 != "") {}
   173    }
   174  }