cuelang.org/go@v0.13.0/cue/testdata/cycle/issue2229.txtar (about)

     1  // Caused evalv2 to stack overflow;
     2  // move to comprehension.txtar once evalv2 is removed so we can avoid the skip line.
     3  #skip-v2
     4  -- in.cue --
     5  issue2229: full_ok: X={
     6  	build: bool | *true
     7  	test:  bool | *true
     8  
     9  	make: [ for k, v in X if (v & true) != _|_ { k } ]
    10  }
    11  issue2229: reduced_fail: X={
    12  	x: true
    13  	y: [ for _, v in X if v & true { _ } ]
    14  }
    15  
    16  -- out/compile --
    17  --- in.cue
    18  {
    19    issue2229: {
    20      full_ok: {
    21        build: (bool|*true)
    22        test: (bool|*true)
    23        make: [
    24          for k, v in 〈2〉 if ((〈0;v〉 & true) != _|_(explicit error (_|_ literal) in source)) {
    25            〈1;k〉
    26          },
    27        ]
    28      }
    29    }
    30    issue2229: {
    31      reduced_fail: {
    32        x: true
    33        y: [
    34          for _, v in 〈2〉 if (〈0;v〉 & true) {
    35            _
    36          },
    37        ]
    38      }
    39    }
    40  }
    41  -- out/evalalpha --
    42  Errors:
    43  conflicting values true and [for _, v in X if (v & true) {_}] (mismatched types bool and list):
    44      ./in.cue:9:5
    45      ./in.cue:9:28
    46  structural cycle:
    47      ./in.cue:9:24
    48  
    49  Result:
    50  (_|_){
    51    // [eval]
    52    issue2229: (_|_){
    53      // [eval]
    54      full_ok: (struct){
    55        build: (bool){ |(*(bool){ true }, (bool){ bool }) }
    56        test: (bool){ |(*(bool){ true }, (bool){ bool }) }
    57        make: (#list){
    58          0: (string){ "build" }
    59          1: (string){ "test" }
    60        }
    61      }
    62      reduced_fail: (_|_){
    63        // [eval]
    64        x: (bool){ true }
    65        y: (_|_){
    66          // [eval] conflicting values true and [for _, v in X if (v & true) {_}] (mismatched types bool and list):
    67          //     ./in.cue:9:5
    68          //     ./in.cue:9:28
    69          // structural cycle:
    70          //     ./in.cue:9:24
    71          0: (_){ _ }
    72        }
    73      }
    74    }
    75  }