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

     1  exec cue eval ./pkg:foo
     2  
     3  -- cue.mod/module.cue --
     4  module: "mod.test"
     5  language: version: "v0.9.0"
     6  -- in.cue --
     7  package foo
     8  
     9  import "mod.test/pkg"
    10  
    11  #def: {
    12  	_name: d: int
    13  }
    14  
    15  d: pkg.#D & {_name: d: int, _val: f: 4}
    16  
    17  // TODO: this should fail, as the _name restricting it is in this
    18  // package.
    19  e: pkg.#D & #def & {
    20  	// This should fail as c is disallowed by the _name defined
    21  	// in this package
    22  	_name: c: int
    23  
    24  	// This should not fail, as this is a different _val
    25  	_val: g: int
    26  }
    27  
    28  f: pkg.#D & {_val: f: 4}
    29  g: f._val
    30  -- pkg/bar.cue --
    31  package pkg
    32  
    33  #D: {_val: f: 3}
    34  -- out/eval/stats --
    35  Leaks:  1
    36  Freed:  29
    37  Reused: 24
    38  Allocs: 6
    39  Retain: 2
    40  
    41  Unifications: 30
    42  Conjuncts:    40
    43  Disjuncts:    31
    44  -- out/evalalpha --
    45  Errors:
    46  e._name.c: field not allowed:
    47      ./in.cue:16:9
    48  
    49  Result:
    50  (_|_){
    51    // [eval]
    52    #def: (#struct){
    53      _name(:foo): (#struct){
    54        d: (int){ int }
    55      }
    56    }
    57    d: (#struct){
    58      _name(:foo): (struct){
    59        d: (int){ int }
    60      }
    61      _val(:foo): (struct){
    62        f: (int){ 4 }
    63      }
    64      _val(mod.test/pkg): (#struct){
    65        f: (int){ 3 }
    66      }
    67    }
    68    e: (_|_){
    69      // [eval]
    70      _name(:foo): (_|_){
    71        // [eval]
    72        c: (_|_){
    73          // [eval] e._name.c: field not allowed:
    74          //     ./in.cue:16:9
    75        }
    76        d: (int){ int }
    77      }
    78      _val(:foo): (struct){
    79        g: (int){ int }
    80      }
    81      _val(mod.test/pkg): (#struct){
    82        f: (int){ 3 }
    83      }
    84    }
    85    f: (#struct){
    86      _val(:foo): (struct){
    87        f: (int){ 4 }
    88      }
    89      _val(mod.test/pkg): (#struct){
    90        f: (int){ 3 }
    91      }
    92    }
    93    g: (struct){
    94      f: (int){ 4 }
    95    }
    96  }
    97  -- diff/-out/evalalpha<==>+out/eval --
    98  diff old new
    99  --- old
   100  +++ new
   101  @@ -1,7 +1,5 @@
   102   Errors:
   103   e._name.c: field not allowed:
   104  -    ./in.cue:6:9
   105  -    ./in.cue:13:13
   106       ./in.cue:16:9
   107   
   108   Result:
   109  @@ -13,9 +11,6 @@
   110       }
   111     }
   112     d: (#struct){
   113  -    _val(mod.test/pkg): (#struct){
   114  -      f: (int){ 3 }
   115  -    }
   116       _name(:foo): (struct){
   117         d: (int){ int }
   118       }
   119  @@ -22,32 +17,33 @@
   120       _val(:foo): (struct){
   121         f: (int){ 4 }
   122       }
   123  +    _val(mod.test/pkg): (#struct){
   124  +      f: (int){ 3 }
   125  +    }
   126     }
   127     e: (_|_){
   128       // [eval]
   129  -    _val(mod.test/pkg): (#struct){
   130  -      f: (int){ 3 }
   131  -    }
   132       _name(:foo): (_|_){
   133         // [eval]
   134  -      d: (int){ int }
   135         c: (_|_){
   136           // [eval] e._name.c: field not allowed:
   137  -        //     ./in.cue:6:9
   138  -        //     ./in.cue:13:13
   139           //     ./in.cue:16:9
   140         }
   141  +      d: (int){ int }
   142       }
   143       _val(:foo): (struct){
   144         g: (int){ int }
   145       }
   146  +    _val(mod.test/pkg): (#struct){
   147  +      f: (int){ 3 }
   148  +    }
   149     }
   150     f: (#struct){
   151  -    _val(mod.test/pkg): (#struct){
   152  -      f: (int){ 3 }
   153  -    }
   154  -    _val(:foo): (struct){
   155  -      f: (int){ 4 }
   156  +    _val(:foo): (struct){
   157  +      f: (int){ 4 }
   158  +    }
   159  +    _val(mod.test/pkg): (#struct){
   160  +      f: (int){ 3 }
   161       }
   162     }
   163     g: (struct){
   164  -- diff/todo/p2 --
   165  Reordering / missing positions.
   166  -- out/eval --
   167  Errors:
   168  e._name.c: field not allowed:
   169      ./in.cue:6:9
   170      ./in.cue:13:13
   171      ./in.cue:16:9
   172  
   173  Result:
   174  (_|_){
   175    // [eval]
   176    #def: (#struct){
   177      _name(:foo): (#struct){
   178        d: (int){ int }
   179      }
   180    }
   181    d: (#struct){
   182      _val(mod.test/pkg): (#struct){
   183        f: (int){ 3 }
   184      }
   185      _name(:foo): (struct){
   186        d: (int){ int }
   187      }
   188      _val(:foo): (struct){
   189        f: (int){ 4 }
   190      }
   191    }
   192    e: (_|_){
   193      // [eval]
   194      _val(mod.test/pkg): (#struct){
   195        f: (int){ 3 }
   196      }
   197      _name(:foo): (_|_){
   198        // [eval]
   199        d: (int){ int }
   200        c: (_|_){
   201          // [eval] e._name.c: field not allowed:
   202          //     ./in.cue:6:9
   203          //     ./in.cue:13:13
   204          //     ./in.cue:16:9
   205        }
   206      }
   207      _val(:foo): (struct){
   208        g: (int){ int }
   209      }
   210    }
   211    f: (#struct){
   212      _val(mod.test/pkg): (#struct){
   213        f: (int){ 3 }
   214      }
   215      _val(:foo): (struct){
   216        f: (int){ 4 }
   217      }
   218    }
   219    g: (struct){
   220      f: (int){ 4 }
   221    }
   222  }
   223  -- out/compile --
   224  --- in.cue
   225  {
   226    #def: {
   227      _name: {
   228        d: int
   229      }
   230    }
   231    d: (〈import;"mod.test/pkg"〉.#D & {
   232      _name: {
   233        d: int
   234      }
   235      _val: {
   236        f: 4
   237      }
   238    })
   239    e: ((〈import;"mod.test/pkg"〉.#D & 〈0;#def〉) & {
   240      _name: {
   241        c: int
   242      }
   243      _val: {
   244        g: int
   245      }
   246    })
   247    f: (〈import;"mod.test/pkg"〉.#D & {
   248      _val: {
   249        f: 4
   250      }
   251    })
   252    g: 〈0;f〉._val
   253  }