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