...

Text file src/cuelang.org/go/cue/testdata/disjunctions/errors.txtar

Documentation: cuelang.org/go/cue/testdata/disjunctions

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

View as plain text