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

     1  // Issue #729
     2  -- in.cue --
     3  ifScalar: {
     4      _#cond: true
     5  
     6      if _#cond {5}
     7  }
     8  
     9  ifScalarConflict: {
    10      _#cond: true
    11  
    12      if _#cond {5}
    13  
    14      "soo"
    15  }
    16  
    17  ifScalarNested: {
    18      _#cond: true
    19  
    20      if _#cond {{{5}}}
    21  
    22  }
    23  -- out/eval --
    24  Errors:
    25  ifScalarConflict: conflicting values "soo" and 5 (mismatched types string and int):
    26      ./in.cue:10:5
    27      ./in.cue:10:16
    28      ./in.cue:12:5
    29  
    30  Result:
    31  (_|_){
    32    // [eval]
    33    ifScalar: (int){
    34      5
    35      _#cond: (bool){ true }
    36    }
    37    ifScalarConflict: (_|_){
    38      // [eval] ifScalarConflict: conflicting values "soo" and 5 (mismatched types string and int):
    39      //     ./in.cue:10:5
    40      //     ./in.cue:10:16
    41      //     ./in.cue:12:5
    42      _#cond: (bool){ true }
    43    }
    44    ifScalarNested: (int){
    45      5
    46      _#cond: (bool){ true }
    47    }
    48  }
    49  -- out/compile --
    50  --- in.cue
    51  {
    52    ifScalar: {
    53      _#cond: true
    54      if 〈0;_#cond〉 {
    55        5
    56      }
    57    }
    58    ifScalarConflict: {
    59      _#cond: true
    60      if 〈0;_#cond〉 {
    61        5
    62      }
    63      "soo"
    64    }
    65    ifScalarNested: {
    66      _#cond: true
    67      if 〈0;_#cond〉 {
    68        {
    69          {
    70            5
    71          }
    72        }
    73      }
    74    }
    75  }