cuelang.org/go@v0.13.0/cue/testdata/eval/closed_disjunction.txtar (about)

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