cuelang.org/go@v0.10.1/cue/testdata/compile/scope.txtar (about)

     1  -- in.cue --
     2  a: {
     3  	{{
     4  		b
     5  		c
     6  		d: b
     7  		e: c
     8  	}}
     9  	c: {}
    10  }
    11  b: {
    12  
    13  }
    14  s: "foo"
    15  c: s
    16  
    17  // s is technically in a new struct here so it will have a one higher count than
    18  // the one before.
    19  d: [s]: 3
    20  
    21  e: {}
    22  e & {// Is this allowed? Probably not as per comprehension rule (ref fixes.)
    23  	e: {}
    24  }
    25  
    26  {X=["foo"]: b: X | null}
    27  {[Y="bar"]: b: Y}
    28  
    29  let B = {open: int}
    30  f: B
    31  
    32  schema: {
    33  	next: _schema_1
    34  }
    35  
    36  let _schema_1 = schema
    37  -- out/compile --
    38  --- in.cue
    39  {
    40    a: {
    41      {
    42        {
    43          〈3;b〉
    44          〈2;c〉
    45          d: 〈3;b〉
    46          e: 〈2;c〉
    47        }
    48      }
    49      c: {}
    50    }
    51    b: {}
    52    s: "foo"
    53    c: 〈0;s〉
    54    d: {
    55      [〈1;s〉]: 3
    56    }
    57    e: {}
    58    (〈0;e〉 & {
    59      e: {}
    60    })
    61    {
    62      ["foo"]: {
    63        b: (〈1;(〈0;-〉)〉|null)
    64      }
    65    }
    66    {
    67      ["bar"]: {
    68        b: 〈1;-〉
    69      }
    70    }
    71    let B#1 = {
    72      open: int
    73    }
    74    f: 〈0;let B#1〉
    75    schema: {
    76      next: 〈1;let _schema_1#2〉
    77    }
    78    let _schema_1#2 = 〈0;schema〉
    79  }
    80  -- out/eval/stats --
    81  Leaks:  2
    82  Freed:  48
    83  Reused: 45
    84  Allocs: 5
    85  Retain: 8
    86  
    87  Unifications: 50
    88  Conjuncts:    102
    89  Disjuncts:    54
    90  -- out/evalalpha --
    91  Errors:
    92  _schema_1: structural cycle:
    93      ./in.cue:32:8
    94  
    95  Result:
    96  (_|_){
    97    // [structural cycle]
    98    a: (struct){
    99      d: (struct){
   100      }
   101      e: (struct){
   102      }
   103      c: (struct){
   104      }
   105    }
   106    b: (struct){
   107    }
   108    s: (string){ "foo" }
   109    c: (string){ "foo" }
   110    d: (struct){
   111    }
   112    e: (struct){
   113    }
   114    let B#1 = (struct){
   115      open: (int){ int }
   116    }
   117    f: (struct){
   118      open: (int){ int }
   119    }
   120    schema: (_|_){
   121      // [structural cycle]
   122      next: (_|_){
   123        // [structural cycle] _schema_1: structural cycle:
   124        //     ./in.cue:32:8
   125      }
   126    }
   127    let _schema_1#2 = (_|_){
   128      // [structural cycle] _schema_1: structural cycle:
   129      //     ./in.cue:32:8
   130    }
   131  }
   132  -- diff/-out/evalalpha<==>+out/eval --
   133  diff old new
   134  --- old
   135  +++ new
   136  @@ -1,5 +1,6 @@
   137   Errors:
   138  -schema.next: structural cycle
   139  +_schema_1: structural cycle:
   140  +    ./in.cue:32:8
   141   
   142   Result:
   143   (_|_){
   144  @@ -29,7 +30,8 @@
   145     schema: (_|_){
   146       // [structural cycle]
   147       next: (_|_){
   148  -      // [structural cycle] schema.next: structural cycle
   149  +      // [structural cycle] _schema_1: structural cycle:
   150  +      //     ./in.cue:32:8
   151       }
   152     }
   153     let _schema_1#2 = (_|_){
   154  -- diff/todo/p3 --
   155  Structural cycle reported in different location. Seems fine, as
   156  ultimately we need to print the paths of the cycle anyway.
   157  Now also reports a position.
   158  -- out/eval --
   159  Errors:
   160  schema.next: structural cycle
   161  
   162  Result:
   163  (_|_){
   164    // [structural cycle]
   165    a: (struct){
   166      d: (struct){
   167      }
   168      e: (struct){
   169      }
   170      c: (struct){
   171      }
   172    }
   173    b: (struct){
   174    }
   175    s: (string){ "foo" }
   176    c: (string){ "foo" }
   177    d: (struct){
   178    }
   179    e: (struct){
   180    }
   181    let B#1 = (struct){
   182      open: (int){ int }
   183    }
   184    f: (struct){
   185      open: (int){ int }
   186    }
   187    schema: (_|_){
   188      // [structural cycle]
   189      next: (_|_){
   190        // [structural cycle] schema.next: structural cycle
   191      }
   192    }
   193    let _schema_1#2 = (_|_){
   194      // [structural cycle] _schema_1: structural cycle:
   195      //     ./in.cue:32:8
   196    }
   197  }