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

     1  // Excluded from V2, which no longer passes.
     2  #skip-v2
     3  // Lots of cycle-reference goodness.
     4  
     5  -- in.cue --
     6  [!~"^[.]"]: c
     7  a:          b
     8  b: [string]: int
     9  c: a:        int
    10  [string]: c
    11  a:        b
    12  b: [string]: int
    13  c: a:        int
    14  
    15  -- issue3326.cue --
    16  issue3326: {
    17  	// This issue triggered a cyclic evaluation in pattern constraints.
    18  	//
    19  	// It seems like there is still an issue as the evaluation of `x` in
    20  	// `and` may trigger a cyclic evaluation of `and`. However, `and` only
    21  	// does a shallow evaluation, and inserting `x`'s conjuncts into itself
    22  	// is identified as idempotent and thus further evaluation is skipped.
    23  	_self: x: [...and(x)]
    24  	_self
    25  	x: [1]
    26  }
    27  -- out/eval/stats --
    28  Leaks:  0
    29  Freed:  7
    30  Reused: 2
    31  Allocs: 5
    32  Retain: 2
    33  
    34  Unifications: 7
    35  Conjuncts:    59
    36  Disjuncts:    9
    37  -- out/evalalpha --
    38  (struct){
    39    a: (struct){
    40      a: (int){ int }
    41    }
    42    b: (struct){
    43      a: (int){ int }
    44    }
    45    c: (struct){
    46      a: (int){ int }
    47    }
    48    issue3326: (struct){
    49      _self: (struct){
    50        x: (list){
    51        }
    52      }
    53      x: (#list){
    54        0: (int){ 1 }
    55      }
    56      a: (int){ int }
    57    }
    58  }
    59  -- diff/-out/evalalpha<==>+out/eval --
    60  diff old new
    61  --- old
    62  +++ new
    63  @@ -8,4 +8,14 @@
    64     c: (struct){
    65       a: (int){ int }
    66     }
    67  +  issue3326: (struct){
    68  +    _self: (struct){
    69  +      x: (list){
    70  +      }
    71  +    }
    72  +    x: (#list){
    73  +      0: (int){ 1 }
    74  +    }
    75  +    a: (int){ int }
    76  +  }
    77   }
    78  -- out/eval --
    79  (struct){
    80    a: (struct){
    81      a: (int){ int }
    82    }
    83    b: (struct){
    84      a: (int){ int }
    85    }
    86    c: (struct){
    87      a: (int){ int }
    88    }
    89  }
    90  -- out/compile --
    91  --- in.cue
    92  {
    93    [!~"^[.]"]: 〈0;c〉
    94    a: 〈0;b〉
    95    b: {
    96      [string]: int
    97    }
    98    c: {
    99      a: int
   100    }
   101    [string]: 〈0;c〉
   102    a: 〈0;b〉
   103    b: {
   104      [string]: int
   105    }
   106    c: {
   107      a: int
   108    }
   109  }
   110  --- issue3326.cue
   111  {
   112    issue3326: {
   113      _self: {
   114        x: [
   115          ...and(〈1;x〉),
   116        ]
   117      }
   118      〈0;_self〉
   119      x: [
   120        1,
   121      ]
   122    }
   123  }