cuelang.org/go@v0.10.1/cue/testdata/definitions/037_conjunction_of_optional_sets.txtar (about)

     1  # DO NOT EDIT; generated by go run testdata/gen.go
     2  #
     3  #name: conjunction of optional sets
     4  #evalFull
     5  -- in.cue --
     6  #A: {
     7  	[=~"^[a-s]*$"]: int
     8  }
     9  #B: {
    10  	[=~"^[m-z]*$"]: int
    11  }
    12  
    13  #C: #A & #B
    14  c:  #C & {aaa: 3}
    15  
    16  #D: {#A & #B}
    17  d: #D & {aaa: 3}
    18  -- out/def --
    19  #A: {
    20  	[=~"^[a-s]*$"]: int
    21  }
    22  #B: {
    23  	[=~"^[m-z]*$"]: int
    24  }
    25  #C: #A & #B
    26  c:  _|_ // field "aaa" not allowed in closed struct
    27  #D: {
    28  	#A & #B
    29  }
    30  d: _|_ // field "aaa" not allowed in closed struct
    31  -- out/legacy-debug --
    32  <0>{#A: <1>C{[=~"^[a-s]*$"]: <2>(_: string)->int, }, #B: <3>C{[=~"^[m-z]*$"]: <4>(_: string)->int, }, #C: <5>C{(C{[=~"^[a-s]*$"]: <6>(_: string)->int} & C{[=~"^[m-z]*$"]: <7>(_: string)->int}), }, c: _|_(3:field "aaa" not allowed in closed struct), #D: <8>C{(C{[=~"^[a-s]*$"]: <9>(_: string)->int} & C{[=~"^[m-z]*$"]: <10>(_: string)->int}), }, d: _|_(3:field "aaa" not allowed in closed struct)}
    33  -- out/compile --
    34  --- in.cue
    35  {
    36    #A: {
    37      [=~"^[a-s]*$"]: int
    38    }
    39    #B: {
    40      [=~"^[m-z]*$"]: int
    41    }
    42    #C: (〈0;#A〉 & 〈0;#B〉)
    43    c: (〈0;#C〉 & {
    44      aaa: 3
    45    })
    46    #D: {
    47      (〈1;#A〉 & 〈1;#B〉)
    48    }
    49    d: (〈0;#D〉 & {
    50      aaa: 3
    51    })
    52  }
    53  -- out/eval/stats --
    54  Leaks:  0
    55  Freed:  9
    56  Reused: 6
    57  Allocs: 3
    58  Retain: 0
    59  
    60  Unifications: 9
    61  Conjuncts:    29
    62  Disjuncts:    9
    63  -- out/evalalpha --
    64  Errors:
    65  c.aaa: field not allowed:
    66      ./in.cue:5:18
    67      ./in.cue:2:2
    68      ./in.cue:9:11
    69  d.aaa: field not allowed:
    70      ./in.cue:5:18
    71      ./in.cue:2:2
    72      ./in.cue:12:10
    73  
    74  Result:
    75  (_|_){
    76    // [eval]
    77    #A: (#struct){
    78    }
    79    #B: (#struct){
    80    }
    81    #C: (#struct){
    82    }
    83    c: (_|_){
    84      // [eval]
    85      aaa: (_|_){
    86        // [eval] c.aaa: field not allowed:
    87        //     ./in.cue:5:18
    88        //     ./in.cue:2:2
    89        //     ./in.cue:9:11
    90      }
    91    }
    92    #D: (#struct){
    93    }
    94    d: (_|_){
    95      // [eval]
    96      aaa: (_|_){
    97        // [eval] d.aaa: field not allowed:
    98        //     ./in.cue:5:18
    99        //     ./in.cue:2:2
   100        //     ./in.cue:12:10
   101      }
   102    }
   103  }
   104  -- diff/-out/evalalpha<==>+out/eval --
   105  diff old new
   106  --- old
   107  +++ new
   108  @@ -1,18 +1,11 @@
   109   Errors:
   110   c.aaa: field not allowed:
   111  -    ./in.cue:2:2
   112  -    ./in.cue:4:5
   113  -    ./in.cue:8:5
   114  -    ./in.cue:8:10
   115  -    ./in.cue:9:5
   116  +    ./in.cue:5:18
   117  +    ./in.cue:2:2
   118       ./in.cue:9:11
   119   d.aaa: field not allowed:
   120  -    ./in.cue:2:2
   121  -    ./in.cue:4:5
   122  -    ./in.cue:11:5
   123  -    ./in.cue:11:6
   124  -    ./in.cue:11:11
   125  -    ./in.cue:12:4
   126  +    ./in.cue:5:18
   127  +    ./in.cue:2:2
   128       ./in.cue:12:10
   129   
   130   Result:
   131  @@ -28,11 +21,8 @@
   132       // [eval]
   133       aaa: (_|_){
   134         // [eval] c.aaa: field not allowed:
   135  -      //     ./in.cue:2:2
   136  -      //     ./in.cue:4:5
   137  -      //     ./in.cue:8:5
   138  -      //     ./in.cue:8:10
   139  -      //     ./in.cue:9:5
   140  +      //     ./in.cue:5:18
   141  +      //     ./in.cue:2:2
   142         //     ./in.cue:9:11
   143       }
   144     }
   145  @@ -42,12 +32,8 @@
   146       // [eval]
   147       aaa: (_|_){
   148         // [eval] d.aaa: field not allowed:
   149  -      //     ./in.cue:2:2
   150  -      //     ./in.cue:4:5
   151  -      //     ./in.cue:11:5
   152  -      //     ./in.cue:11:6
   153  -      //     ./in.cue:11:11
   154  -      //     ./in.cue:12:4
   155  +      //     ./in.cue:5:18
   156  +      //     ./in.cue:2:2
   157         //     ./in.cue:12:10
   158       }
   159     }
   160  -- diff/todo/p2 --
   161  Missing positions.
   162  -- out/eval --
   163  Errors:
   164  c.aaa: field not allowed:
   165      ./in.cue:2:2
   166      ./in.cue:4:5
   167      ./in.cue:8:5
   168      ./in.cue:8:10
   169      ./in.cue:9:5
   170      ./in.cue:9:11
   171  d.aaa: field not allowed:
   172      ./in.cue:2:2
   173      ./in.cue:4:5
   174      ./in.cue:11:5
   175      ./in.cue:11:6
   176      ./in.cue:11:11
   177      ./in.cue:12:4
   178      ./in.cue:12:10
   179  
   180  Result:
   181  (_|_){
   182    // [eval]
   183    #A: (#struct){
   184    }
   185    #B: (#struct){
   186    }
   187    #C: (#struct){
   188    }
   189    c: (_|_){
   190      // [eval]
   191      aaa: (_|_){
   192        // [eval] c.aaa: field not allowed:
   193        //     ./in.cue:2:2
   194        //     ./in.cue:4:5
   195        //     ./in.cue:8:5
   196        //     ./in.cue:8:10
   197        //     ./in.cue:9:5
   198        //     ./in.cue:9:11
   199      }
   200    }
   201    #D: (#struct){
   202    }
   203    d: (_|_){
   204      // [eval]
   205      aaa: (_|_){
   206        // [eval] d.aaa: field not allowed:
   207        //     ./in.cue:2:2
   208        //     ./in.cue:4:5
   209        //     ./in.cue:11:5
   210        //     ./in.cue:11:6
   211        //     ./in.cue:11:11
   212        //     ./in.cue:12:4
   213        //     ./in.cue:12:10
   214      }
   215    }
   216  }