cuelang.org/go@v0.13.0/cue/testdata/definitions/issue533.txtar (about)

     1  -- in.cue --
     2  package x
     3  
     4  #x: {
     5  	Name: string
     6  }
     7  
     8  _#x: {
     9  	Name: string
    10  }
    11  
    12  x1: #x & {
    13  	Name: "hello"
    14  	Age:  50
    15  }
    16  
    17  x2: _#x & {
    18  	Name: "hello"
    19  	Age:  50
    20  }
    21  -- out/eval/stats --
    22  Leaks:  0
    23  Freed:  11
    24  Reused: 8
    25  Allocs: 3
    26  Retain: 0
    27  
    28  Unifications: 11
    29  Conjuncts:    17
    30  Disjuncts:    11
    31  -- out/evalalpha --
    32  Errors:
    33  x1.Age: field not allowed:
    34      ./in.cue:13:2
    35  x2.Age: field not allowed:
    36      ./in.cue:18:2
    37  
    38  Result:
    39  (_|_){
    40    // [eval]
    41    #x: (#struct){
    42      Name: (string){ string }
    43    }
    44    _#x(:x): (#struct){
    45      Name: (string){ string }
    46    }
    47    x1: (_|_){
    48      // [eval]
    49      Name: (string){ "hello" }
    50      Age: (_|_){
    51        // [eval] x1.Age: field not allowed:
    52        //     ./in.cue:13:2
    53      }
    54    }
    55    x2: (_|_){
    56      // [eval]
    57      Name: (string){ "hello" }
    58      Age: (_|_){
    59        // [eval] x2.Age: field not allowed:
    60        //     ./in.cue:18:2
    61      }
    62    }
    63  }
    64  -- diff/-out/evalalpha<==>+out/eval --
    65  diff old new
    66  --- old
    67  +++ new
    68  @@ -1,11 +1,7 @@
    69   Errors:
    70   x1.Age: field not allowed:
    71  -    ./in.cue:3:5
    72  -    ./in.cue:11:5
    73       ./in.cue:13:2
    74   x2.Age: field not allowed:
    75  -    ./in.cue:7:6
    76  -    ./in.cue:16:5
    77       ./in.cue:18:2
    78   
    79   Result:
    80  @@ -22,8 +18,6 @@
    81       Name: (string){ "hello" }
    82       Age: (_|_){
    83         // [eval] x1.Age: field not allowed:
    84  -      //     ./in.cue:3:5
    85  -      //     ./in.cue:11:5
    86         //     ./in.cue:13:2
    87       }
    88     }
    89  @@ -32,8 +26,6 @@
    90       Name: (string){ "hello" }
    91       Age: (_|_){
    92         // [eval] x2.Age: field not allowed:
    93  -      //     ./in.cue:7:6
    94  -      //     ./in.cue:16:5
    95         //     ./in.cue:18:2
    96       }
    97     }
    98  -- diff/todo/p2 --
    99  Positions.
   100  -- out/eval --
   101  Errors:
   102  x1.Age: field not allowed:
   103      ./in.cue:3:5
   104      ./in.cue:11:5
   105      ./in.cue:13:2
   106  x2.Age: field not allowed:
   107      ./in.cue:7:6
   108      ./in.cue:16:5
   109      ./in.cue:18:2
   110  
   111  Result:
   112  (_|_){
   113    // [eval]
   114    #x: (#struct){
   115      Name: (string){ string }
   116    }
   117    _#x(:x): (#struct){
   118      Name: (string){ string }
   119    }
   120    x1: (_|_){
   121      // [eval]
   122      Name: (string){ "hello" }
   123      Age: (_|_){
   124        // [eval] x1.Age: field not allowed:
   125        //     ./in.cue:3:5
   126        //     ./in.cue:11:5
   127        //     ./in.cue:13:2
   128      }
   129    }
   130    x2: (_|_){
   131      // [eval]
   132      Name: (string){ "hello" }
   133      Age: (_|_){
   134        // [eval] x2.Age: field not allowed:
   135        //     ./in.cue:7:6
   136        //     ./in.cue:16:5
   137        //     ./in.cue:18:2
   138      }
   139    }
   140  }
   141  -- out/compile --
   142  --- in.cue
   143  {
   144    #x: {
   145      Name: string
   146    }
   147    _#x: {
   148      Name: string
   149    }
   150    x1: (〈0;#x〉 & {
   151      Name: "hello"
   152      Age: 50
   153    })
   154    x2: (〈0;_#x〉 & {
   155      Name: "hello"
   156      Age: 50
   157    })
   158  }