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

     1  -- in.cue --
     2  
     3  fatalArg: {
     4      x: len("eee" + 'eee')
     5  }
     6  
     7  // don't call builtin for a permanent error of a child node
     8  fatalChild: {
     9      #b: {}
    10      x: and([{a: #b.c}])
    11  }
    12  
    13  // allow incomplete child values. The error will persist after `and` is
    14  // evaluated down the line. This allows the and-ing of templates that may
    15  // complete later.
    16  okIncompleteChild: {
    17      b: {}
    18      x: and([{a: b.c}, {b: 1}])
    19  }
    20  
    21  -- out/eval --
    22  Errors:
    23  fatalArg.x: invalid operands "eee" and 'eee' to '+' (type string and bytes):
    24      ./in.cue:3:12
    25      ./in.cue:3:20
    26  0.a: undefined field: c:
    27      ./in.cue:9:20
    28  
    29  Result:
    30  (_|_){
    31    // [eval]
    32    fatalArg: (_|_){
    33      // [eval]
    34      x: (_|_){
    35        // [eval] fatalArg.x: invalid operands "eee" and 'eee' to '+' (type string and bytes):
    36        //     ./in.cue:3:12
    37        //     ./in.cue:3:20
    38      }
    39    }
    40    fatalChild: (_|_){
    41      // [eval]
    42      #b: (#struct){
    43      }
    44      x: (_|_){
    45        // [eval] 0.a: undefined field: c:
    46        //     ./in.cue:9:20
    47      }
    48    }
    49    okIncompleteChild: (struct){
    50      b: (struct){
    51      }
    52      x: (struct){
    53        a: (_|_){
    54          // [incomplete] okIncompleteChild.x.a: undefined field: c:
    55          //     ./in.cue:17:19
    56        }
    57        b: (int){ 1 }
    58      }
    59    }
    60  }
    61  -- out/compile --
    62  --- in.cue
    63  {
    64    fatalArg: {
    65      x: len(("eee" + 'eee'))
    66    }
    67    fatalChild: {
    68      #b: {}
    69      x: and([
    70        {
    71          a: 〈1;#b〉.c
    72        },
    73      ])
    74    }
    75    okIncompleteChild: {
    76      b: {}
    77      x: and([
    78        {
    79          a: 〈1;b〉.c
    80        },
    81        {
    82          b: 1
    83        },
    84      ])
    85    }
    86  }