cuelang.org/go@v0.10.1/cue/testdata/eval/closedness.txtar (about)

     1  // Issue #852
     2  
     3  -- in.cue --
     4  #E: {
     5  	c: int
     6  }
     7  #A: {
     8  	b: int
     9  	q: {
    10  		#E
    11  		d: int
    12  	}
    13  }
    14  a: #A & {
    15  	b: 3
    16  	q: {
    17  		c: 2
    18  		e: 43
    19  	}
    20  }
    21  
    22  // `a` is evaluated through the comprehension first. Ensure that
    23  // this does not bypass closedness checks.
    24  issue852: {
    25  	#A: {
    26  		[=~"^a-z$"]: string
    27  	}
    28  
    29  	a: #A
    30  
    31  	a: Foo: "foo"
    32  
    33  	for k, v in a {
    34  		b: "\(k)": v
    35  	}
    36  }
    37  
    38  dynamic: {
    39  	#D: {
    40  		key:   "foo"
    41  		(key): int
    42  	}
    43  	d: #D & {foo: 3}
    44  }
    45  -- embed.cue --
    46  issue3325: ok: {
    47  	#Items: [Name=string]: {
    48  		name: Name
    49  	}
    50  
    51  	#Base: {
    52  		name: "base"
    53  		type: string
    54  
    55  		items: #Items
    56  	}
    57  
    58  	#Extended: #Base & {
    59  		type: "extended"
    60  		items: "my-item": {}
    61  	}
    62  
    63  	broken: {
    64  		#Base
    65  		#Extended
    66  	}
    67  
    68  	works: {
    69  		#Extended
    70  		#Base
    71  	}
    72  }
    73  -- reroot.cue --
    74  import "list"
    75  
    76  issue3330: {
    77  	let: ok: {
    78  		#struct: {
    79  			let empty = {}
    80  
    81  			field: null | { n: int }
    82  			field: empty & { n: 3 }
    83  		}
    84  
    85  		out: list.Concat([[#struct]])
    86  	}
    87  	matthew: ok1: {
    88  		#struct: {
    89  			field: { n: 3 } & g
    90  			g: {}
    91  		}
    92  
    93  		out: #struct & {}
    94  	}
    95  	matthew: ok2: {
    96  		#struct: {
    97  			field: { n: 3 } & g
    98  			g: {}
    99  		}
   100  
   101  		out: #struct
   102  		out2: out & {}
   103  	}
   104  }
   105  issue3331: {
   106  	original: ok: {
   107  		#A: {
   108  			let b = {}
   109  			c: b & {
   110  				d: 1
   111  			}
   112  		}
   113  		list.Concat([[#A]])
   114  	}
   115  	variant1: ok: {
   116  		#A: {
   117  			let b = {}
   118  			c: b & {
   119  				d: 1
   120  			}
   121  		}
   122  		[[#A]]
   123  	}
   124  }
   125  
   126  // indirect tests cases where a reference indirectly crosses a node that
   127  // references a definition, thereby indirectly referencing it.
   128  indirect: {
   129  	embed: err1: {
   130  		#A: {
   131  			x: {#x, #y}
   132  			zx: x.a
   133  		}
   134  
   135  		#x: {a: b: 1}
   136  		#y: {a: c: 2}
   137  
   138  		b: #A
   139  
   140  		b1: b.zx
   141  		b1: d: 1 // TODO: this should fail as b.zx crosses a reference to definition.
   142  	}
   143  	closed: err1: {
   144  		X: {
   145  			// refer to a value that will be closed after unification in another struct.
   146  			a: b
   147  			b: {}
   148  			a: e: 1
   149  		}
   150  		Y: X
   151  		Y: {
   152  			b: c
   153  			c: #X
   154  		}
   155  		#X: {}
   156  	}
   157  }
   158  // nested.a
   159  nested: ok1: {
   160  	#A: {
   161  	b: {}
   162  
   163  	#B: {
   164  		c: b & {
   165  			d: 1
   166  			}
   167  		}
   168  	}
   169  	x: #A
   170  }
   171  nested: embed: ok: {
   172  	x: #A
   173  	#A: {
   174  		k
   175  	}
   176  	k: {
   177  		d: b & {e: int}
   178  		b: {}
   179  	}
   180  }
   181  // nested.b tests insertion of a field (b) that has a conjunct rooted within
   182  // the tree it is referred in as well as a conjunct outside of it that refers
   183  // to a definition.
   184  nested: err1: {
   185  	x: #A
   186  	#A: {
   187  		b: f: 1
   188  		v: #V
   189  		#V: {
   190  			c: b & { // Fails as #B is not compatible.
   191  				d: 1
   192  			}
   193  		}
   194  	}
   195  	x: b: #B
   196  	#B: g: 1
   197  }
   198  
   199  nested: err2: {
   200  	#A: {
   201  		b: {} // error only reported here.
   202  		c: b & {
   203  			// error (g not allowed) not reported here, as it would be okay if b
   204  			// were valid. Instead, it is reported at b only. This is conform
   205  			// the spec.
   206  			d: 1
   207  		}
   208  	}
   209  	x: #A
   210  	x: b: g: 1
   211  }
   212  
   213  inline: {
   214  	#x: y: z?: name: string
   215  
   216  	err1: (#x & {y: z: _}).y.z & {
   217  		name: "a"
   218  		age1: 5 // not allowed
   219  	}
   220  	err2: (#x.y & {z: _}).z & {
   221  		name: "a"
   222  		age2: 5 // not allowed
   223  	}
   224  }
   225  -- validation.cue --
   226  import "list"
   227  
   228  issue3332: {
   229  	#def: field: list.MinItems(1)
   230  	use: #def & {
   231  	  field: ["value"]
   232  	}
   233  }
   234  
   235  -- out/eval/stats --
   236  Leaks:  3
   237  Freed:  269
   238  Reused: 261
   239  Allocs: 11
   240  Retain: 29
   241  
   242  Unifications: 264
   243  Conjuncts:    482
   244  Disjuncts:    299
   245  -- out/eval --
   246  Errors:
   247  a.q.e: field not allowed:
   248      ./in.cue:1:5
   249      ./in.cue:6:5
   250      ./in.cue:7:3
   251      ./in.cue:11:4
   252      ./in.cue:15:3
   253  indirect.closed.err1.Y.a.e: field not allowed:
   254      ./reroot.cue:73:7
   255      ./reroot.cue:74:7
   256      ./reroot.cue:75:7
   257      ./reroot.cue:77:6
   258      ./reroot.cue:79:7
   259      ./reroot.cue:80:7
   260      ./reroot.cue:82:7
   261  issue852.a.Foo: field not allowed:
   262      ./in.cue:22:6
   263      ./in.cue:26:5
   264      ./in.cue:28:5
   265  nested.err1.x.#V.c.d: field not allowed:
   266      ./reroot.cue:112:5
   267      ./reroot.cue:114:6
   268      ./reroot.cue:117:7
   269      ./reroot.cue:118:5
   270      ./reroot.cue:122:8
   271      ./reroot.cue:123:6
   272  nested.err1.x.#V.c.f: field not allowed:
   273      ./reroot.cue:112:5
   274      ./reroot.cue:114:6
   275      ./reroot.cue:117:7
   276      ./reroot.cue:117:11
   277      ./reroot.cue:122:8
   278      ./reroot.cue:123:6
   279  nested.err1.x.b.f: field not allowed:
   280      ./reroot.cue:112:5
   281      ./reroot.cue:114:6
   282      ./reroot.cue:122:8
   283      ./reroot.cue:123:6
   284  nested.err1.x.b.g: field not allowed:
   285      ./reroot.cue:112:5
   286      ./reroot.cue:114:6
   287      ./reroot.cue:122:8
   288      ./reroot.cue:123:6
   289  nested.err1.x.v.c.d: field not allowed:
   290      ./reroot.cue:112:5
   291      ./reroot.cue:114:6
   292      ./reroot.cue:115:6
   293      ./reroot.cue:117:7
   294      ./reroot.cue:118:5
   295      ./reroot.cue:122:8
   296      ./reroot.cue:123:6
   297  nested.err1.x.v.c.f: field not allowed:
   298      ./reroot.cue:112:5
   299      ./reroot.cue:114:6
   300      ./reroot.cue:115:6
   301      ./reroot.cue:117:7
   302      ./reroot.cue:117:11
   303      ./reroot.cue:122:8
   304      ./reroot.cue:123:6
   305  nested.err2.x.b.g: field not allowed:
   306      ./reroot.cue:128:6
   307      ./reroot.cue:136:5
   308      ./reroot.cue:137:8
   309  
   310  Result:
   311  (_|_){
   312    // [eval]
   313    issue3325: (struct){
   314      ok: (struct){
   315        #Items: (#struct){
   316        }
   317        #Base: (#struct){
   318          name: (string){ "base" }
   319          type: (string){ string }
   320          items: (#struct){
   321          }
   322        }
   323        #Extended: (#struct){
   324          name: (string){ "base" }
   325          type: (string){ "extended" }
   326          items: (#struct){
   327            "my-item": (#struct){
   328              name: (string){ "my-item" }
   329            }
   330          }
   331        }
   332        broken: (#struct){
   333          name: (string){ "base" }
   334          type: (string){ "extended" }
   335          items: (#struct){
   336            "my-item": (#struct){
   337              name: (string){ "my-item" }
   338            }
   339          }
   340        }
   341        works: (#struct){
   342          name: (string){ "base" }
   343          type: (string){ "extended" }
   344          items: (#struct){
   345            "my-item": (#struct){
   346              name: (string){ "my-item" }
   347            }
   348          }
   349        }
   350      }
   351    }
   352    #E: (#struct){
   353      c: (int){ int }
   354    }
   355    #A: (#struct){
   356      b: (int){ int }
   357      q: (#struct){
   358        c: (int){ int }
   359        d: (int){ int }
   360      }
   361    }
   362    a: (_|_){
   363      // [eval]
   364      b: (int){ 3 }
   365      q: (_|_){
   366        // [eval]
   367        c: (int){ 2 }
   368        d: (int){ int }
   369        e: (_|_){
   370          // [eval] a.q.e: field not allowed:
   371          //     ./in.cue:1:5
   372          //     ./in.cue:6:5
   373          //     ./in.cue:7:3
   374          //     ./in.cue:11:4
   375          //     ./in.cue:15:3
   376        }
   377      }
   378    }
   379    issue852: (_|_){
   380      // [eval] issue852.a.Foo: field not allowed:
   381      //     ./in.cue:22:6
   382      //     ./in.cue:26:5
   383      //     ./in.cue:28:5
   384      #A: (#struct){
   385      }
   386      a: (_|_){
   387        // [eval]
   388        Foo: (_|_){
   389          // [eval] issue852.a.Foo: field not allowed:
   390          //     ./in.cue:22:6
   391          //     ./in.cue:26:5
   392          //     ./in.cue:28:5
   393        }
   394      }
   395    }
   396    dynamic: (struct){
   397      #D: (#struct){
   398        key: (string){ "foo" }
   399        foo: (int){ int }
   400      }
   401      d: (#struct){
   402        key: (string){ "foo" }
   403        foo: (int){ 3 }
   404      }
   405    }
   406    issue3330: (struct){
   407      let: (struct){
   408        ok: (struct){
   409          #struct: (#struct){
   410            let empty#1 = (#struct){
   411            }
   412            field: (#struct){
   413              n: (int){ 3 }
   414            }
   415          }
   416          out: (#list){
   417            0: (#struct){
   418              let empty#1 = (#struct){
   419              }
   420              field: (#struct){
   421                n: (int){ 3 }
   422              }
   423            }
   424          }
   425        }
   426      }
   427      matthew: (struct){
   428        ok1: (struct){
   429          #struct: (#struct){
   430            field: (#struct){
   431              n: (int){ 3 }
   432            }
   433            g: (#struct){
   434            }
   435          }
   436          out: (#struct){
   437            field: (#struct){
   438              n: (int){ 3 }
   439            }
   440            g: (#struct){
   441            }
   442          }
   443        }
   444        ok2: (struct){
   445          #struct: (#struct){
   446            field: (#struct){
   447              n: (int){ 3 }
   448            }
   449            g: (#struct){
   450            }
   451          }
   452          out: (#struct){
   453            field: (#struct){
   454              n: (int){ 3 }
   455            }
   456            g: (#struct){
   457            }
   458          }
   459          out2: (#struct){
   460            field: (#struct){
   461              n: (int){ 3 }
   462            }
   463            g: (#struct){
   464            }
   465          }
   466        }
   467      }
   468    }
   469    issue3331: (struct){
   470      original: (struct){
   471        ok: (#list){
   472          #A: (#struct){
   473            let b#2 = (#struct){
   474            }
   475            c: (#struct){
   476              d: (int){ 1 }
   477            }
   478          }
   479          0: (#struct){
   480            let b#2 = (#struct){
   481            }
   482            c: (#struct){
   483              d: (int){ 1 }
   484            }
   485          }
   486        }
   487      }
   488      variant1: (struct){
   489        ok: (#list){
   490          #A: (#struct){
   491            let b#3 = (#struct){
   492            }
   493            c: (#struct){
   494              d: (int){ 1 }
   495            }
   496          }
   497          0: (#list){
   498            0: (#struct){
   499              let b#3 = (#struct){
   500              }
   501              c: (#struct){
   502                d: (int){ 1 }
   503              }
   504            }
   505          }
   506        }
   507      }
   508    }
   509    indirect: (_|_){
   510      // [eval]
   511      embed: (struct){
   512        err1: (struct){
   513          #A: (#struct){
   514            x: (#struct){
   515              a: (#struct){
   516                b: (int){ 1 }
   517                c: (int){ 2 }
   518              }
   519            }
   520            zx: (#struct){
   521              b: (int){ 1 }
   522              c: (int){ 2 }
   523            }
   524          }
   525          #x: (#struct){
   526            a: (#struct){
   527              b: (int){ 1 }
   528            }
   529          }
   530          #y: (#struct){
   531            a: (#struct){
   532              c: (int){ 2 }
   533            }
   534          }
   535          b: (#struct){
   536            x: (#struct){
   537              a: (#struct){
   538                b: (int){ 1 }
   539                c: (int){ 2 }
   540              }
   541            }
   542            zx: (#struct){
   543              b: (int){ 1 }
   544              c: (int){ 2 }
   545            }
   546          }
   547          b1: (struct){
   548            b: (int){ 1 }
   549            c: (int){ 2 }
   550            d: (int){ 1 }
   551          }
   552        }
   553      }
   554      closed: (_|_){
   555        // [eval]
   556        err1: (_|_){
   557          // [eval]
   558          X: (struct){
   559            a: (struct){
   560              e: (int){ 1 }
   561            }
   562            b: (struct){
   563            }
   564          }
   565          Y: (_|_){
   566            // [eval]
   567            a: (_|_){
   568              // [eval]
   569              e: (_|_){
   570                // [eval] indirect.closed.err1.Y.a.e: field not allowed:
   571                //     ./reroot.cue:73:7
   572                //     ./reroot.cue:74:7
   573                //     ./reroot.cue:75:7
   574                //     ./reroot.cue:77:6
   575                //     ./reroot.cue:79:7
   576                //     ./reroot.cue:80:7
   577                //     ./reroot.cue:82:7
   578              }
   579            }
   580            b: (#struct){
   581            }
   582            c: (#struct){
   583            }
   584          }
   585          #X: (#struct){
   586          }
   587        }
   588      }
   589    }
   590    nested: (_|_){
   591      // [eval]
   592      ok1: (struct){
   593        #A: (#struct){
   594          b: (#struct){
   595          }
   596          #B: (#struct){
   597            c: (#struct){
   598              d: (int){ 1 }
   599            }
   600          }
   601        }
   602        x: (#struct){
   603          b: (#struct){
   604          }
   605          #B: (#struct){
   606            c: (#struct){
   607              d: (int){ 1 }
   608            }
   609          }
   610        }
   611      }
   612      embed: (struct){
   613        ok: (struct){
   614          x: (#struct){
   615            d: (#struct){
   616              e: (int){ int }
   617            }
   618            b: (#struct){
   619            }
   620          }
   621          #A: (#struct){
   622            d: (#struct){
   623              e: (int){ int }
   624            }
   625            b: (#struct){
   626            }
   627          }
   628          k: (struct){
   629            d: (struct){
   630              e: (int){ int }
   631            }
   632            b: (struct){
   633            }
   634          }
   635        }
   636      }
   637      err1: (_|_){
   638        // [eval]
   639        x: (_|_){
   640          // [eval]
   641          b: (_|_){
   642            // [eval]
   643            f: (_|_){
   644              // [eval] nested.err1.x.b.f: field not allowed:
   645              //     ./reroot.cue:112:5
   646              //     ./reroot.cue:114:6
   647              //     ./reroot.cue:122:8
   648              //     ./reroot.cue:123:6
   649            }
   650            g: (_|_){
   651              // [eval] nested.err1.x.b.g: field not allowed:
   652              //     ./reroot.cue:112:5
   653              //     ./reroot.cue:114:6
   654              //     ./reroot.cue:122:8
   655              //     ./reroot.cue:123:6
   656            }
   657          }
   658          v: (_|_){
   659            // [eval]
   660            c: (_|_){
   661              // [eval]
   662              f: (_|_){
   663                // [eval] nested.err1.x.v.c.f: field not allowed:
   664                //     ./reroot.cue:112:5
   665                //     ./reroot.cue:114:6
   666                //     ./reroot.cue:115:6
   667                //     ./reroot.cue:117:7
   668                //     ./reroot.cue:117:11
   669                //     ./reroot.cue:122:8
   670                //     ./reroot.cue:123:6
   671              }
   672              g: (int){ 1 }
   673              d: (_|_){
   674                // [eval] nested.err1.x.v.c.d: field not allowed:
   675                //     ./reroot.cue:112:5
   676                //     ./reroot.cue:114:6
   677                //     ./reroot.cue:115:6
   678                //     ./reroot.cue:117:7
   679                //     ./reroot.cue:118:5
   680                //     ./reroot.cue:122:8
   681                //     ./reroot.cue:123:6
   682              }
   683            }
   684          }
   685          #V: (_|_){
   686            // [eval]
   687            c: (_|_){
   688              // [eval]
   689              f: (_|_){
   690                // [eval] nested.err1.x.#V.c.f: field not allowed:
   691                //     ./reroot.cue:112:5
   692                //     ./reroot.cue:114:6
   693                //     ./reroot.cue:117:7
   694                //     ./reroot.cue:117:11
   695                //     ./reroot.cue:122:8
   696                //     ./reroot.cue:123:6
   697              }
   698              g: (int){ 1 }
   699              d: (_|_){
   700                // [eval] nested.err1.x.#V.c.d: field not allowed:
   701                //     ./reroot.cue:112:5
   702                //     ./reroot.cue:114:6
   703                //     ./reroot.cue:117:7
   704                //     ./reroot.cue:118:5
   705                //     ./reroot.cue:122:8
   706                //     ./reroot.cue:123:6
   707              }
   708            }
   709          }
   710        }
   711        #A: (#struct){
   712          b: (#struct){
   713            f: (int){ 1 }
   714          }
   715          v: (#struct){
   716            c: (#struct){
   717              f: (int){ 1 }
   718              d: (int){ 1 }
   719            }
   720          }
   721          #V: (#struct){
   722            c: (#struct){
   723              f: (int){ 1 }
   724              d: (int){ 1 }
   725            }
   726          }
   727        }
   728        #B: (#struct){
   729          g: (int){ 1 }
   730        }
   731      }
   732      err2: (_|_){
   733        // [eval]
   734        #A: (#struct){
   735          b: (#struct){
   736          }
   737          c: (#struct){
   738            d: (int){ 1 }
   739          }
   740        }
   741        x: (_|_){
   742          // [eval]
   743          b: (_|_){
   744            // [eval]
   745            g: (_|_){
   746              // [eval] nested.err2.x.b.g: field not allowed:
   747              //     ./reroot.cue:128:6
   748              //     ./reroot.cue:136:5
   749              //     ./reroot.cue:137:8
   750            }
   751          }
   752          c: (#struct){
   753            g: (int){ 1 }
   754            d: (int){ 1 }
   755          }
   756        }
   757      }
   758    }
   759    inline: (struct){
   760      #x: (#struct){
   761        y: (#struct){
   762          z?: (#struct){
   763            name: (string){ string }
   764          }
   765        }
   766      }
   767      err1: (struct){
   768        name: (string){ "a" }
   769        age1: (int){ 5 }
   770      }
   771      err2: (struct){
   772        name: (string){ "a" }
   773        age2: (int){ 5 }
   774      }
   775    }
   776    issue3332: (struct){
   777      #def: (#struct){
   778        field: (list){ list.MinItems(1) }
   779      }
   780      use: (#struct){
   781        field: (#list){
   782          0: (string){ "value" }
   783        }
   784      }
   785    }
   786  }
   787  -- out/evalalpha --
   788  Errors:
   789  nested.err1.x.b.f: field not allowed:
   790      ./reroot.cue:114:6
   791  nested.err2.x.b.g: field not allowed:
   792      ./reroot.cue:137:8
   793  a.q.e: field not allowed:
   794      ./in.cue:7:3
   795      ./in.cue:15:3
   796  issue852.a.Foo: field not allowed:
   797      ./in.cue:23:16
   798      ./in.cue:28:5
   799  nested.err1.x.#V.c.d: field not allowed:
   800      ./reroot.cue:122:8
   801      ./reroot.cue:118:5
   802  nested.err1.x.#V.c.f: field not allowed:
   803      ./reroot.cue:122:8
   804      ./reroot.cue:114:6
   805  nested.err1.x.b.g: field not allowed:
   806      ./reroot.cue:122:8
   807  inline.err1.age1: field not allowed:
   808      ./reroot.cue:143:8
   809      ./reroot.cue:145:3
   810  inline.err2.age2: field not allowed:
   811      ./reroot.cue:147:8
   812      ./reroot.cue:149:3
   813  
   814  Result:
   815  (_|_){
   816    // [eval]
   817    issue3325: (struct){
   818      ok: (struct){
   819        #Items: (#struct){
   820        }
   821        #Base: (#struct){
   822          name: (string){ "base" }
   823          type: (string){ string }
   824          items: (#struct){
   825          }
   826        }
   827        #Extended: (#struct){
   828          type: (string){ "extended" }
   829          items: (#struct){
   830            "my-item": (#struct){
   831              name: (string){ "my-item" }
   832            }
   833          }
   834          name: (string){ "base" }
   835        }
   836        broken: (#struct){
   837          name: (string){ "base" }
   838          type: (string){ "extended" }
   839          items: (#struct){
   840            "my-item": (#struct){
   841              name: (string){ "my-item" }
   842            }
   843          }
   844        }
   845        works: (#struct){
   846          type: (string){ "extended" }
   847          items: (#struct){
   848            "my-item": (#struct){
   849              name: (string){ "my-item" }
   850            }
   851          }
   852          name: (string){ "base" }
   853        }
   854      }
   855    }
   856    #E: (#struct){
   857      c: (int){ int }
   858    }
   859    #A: (#struct){
   860      b: (int){ int }
   861      q: (#struct){
   862        d: (int){ int }
   863        c: (int){ int }
   864      }
   865    }
   866    a: (_|_){
   867      // [eval]
   868      b: (int){ 3 }
   869      q: (_|_){
   870        // [eval]
   871        c: (int){ 2 }
   872        e: (_|_){
   873          // [eval] a.q.e: field not allowed:
   874          //     ./in.cue:7:3
   875          //     ./in.cue:15:3
   876        }
   877        d: (int){ int }
   878      }
   879    }
   880    issue852: (_|_){
   881      // [eval] issue852.a.Foo: field not allowed:
   882      //     ./in.cue:23:16
   883      //     ./in.cue:28:5
   884      #A: (#struct){
   885      }
   886      a: (_|_){
   887        // [eval]
   888        Foo: (_|_){
   889          // [eval] issue852.a.Foo: field not allowed:
   890          //     ./in.cue:23:16
   891          //     ./in.cue:28:5
   892        }
   893      }
   894    }
   895    dynamic: (struct){
   896      #D: (#struct){
   897        key: (string){ "foo" }
   898        foo: (int){ int }
   899      }
   900      d: (#struct){
   901        foo: (int){ 3 }
   902        key: (string){ "foo" }
   903      }
   904    }
   905    issue3330: (struct){
   906      let: (struct){
   907        ok: (struct){
   908          #struct: (#struct){
   909            let empty#1 = (#struct){
   910            }
   911            field: (#struct){
   912              n: (int){ 3 }
   913            }
   914          }
   915          out: (#list){
   916            0: (#struct){
   917              let empty#1 = (#struct){
   918              }
   919              field: (#struct){
   920                n: (int){ 3 }
   921              }
   922            }
   923          }
   924        }
   925      }
   926      matthew: (struct){
   927        ok1: (struct){
   928          #struct: (#struct){
   929            field: (#struct){
   930              n: (int){ 3 }
   931            }
   932            g: (#struct){
   933            }
   934          }
   935          out: (#struct){
   936            field: (#struct){
   937              n: (int){ 3 }
   938            }
   939            g: (#struct){
   940            }
   941          }
   942        }
   943        ok2: (struct){
   944          #struct: (#struct){
   945            field: (#struct){
   946              n: (int){ 3 }
   947            }
   948            g: (#struct){
   949            }
   950          }
   951          out: (#struct){
   952            field: (#struct){
   953              n: (int){ 3 }
   954            }
   955            g: (#struct){
   956            }
   957          }
   958          out2: (struct){
   959            field: (struct){
   960              n: (int){ 3 }
   961            }
   962            g: (struct){
   963            }
   964          }
   965        }
   966      }
   967    }
   968    issue3331: (struct){
   969      original: (struct){
   970        ok: (#list){
   971          #A: (#struct){
   972            let b#2 = (#struct){
   973            }
   974            c: (#struct){
   975              d: (int){ 1 }
   976            }
   977          }
   978          0: (#struct){
   979            let b#2 = (#struct){
   980            }
   981            c: (#struct){
   982              d: (int){ 1 }
   983            }
   984          }
   985        }
   986      }
   987      variant1: (struct){
   988        ok: (#list){
   989          #A: (#struct){
   990            let b#3 = (#struct){
   991            }
   992            c: (#struct){
   993              d: (int){ 1 }
   994            }
   995          }
   996          0: (#list){
   997            0: (#struct){
   998              let b#3 = (#struct){
   999              }
  1000              c: (#struct){
  1001                d: (int){ 1 }
  1002              }
  1003            }
  1004          }
  1005        }
  1006      }
  1007    }
  1008    indirect: (struct){
  1009      embed: (struct){
  1010        err1: (struct){
  1011          #A: (#struct){
  1012            x: (#struct){
  1013              a: (#struct){
  1014                b: (int){ 1 }
  1015                c: (int){ 2 }
  1016              }
  1017            }
  1018            zx: (#struct){
  1019              b: (int){ 1 }
  1020              c: (int){ 2 }
  1021            }
  1022          }
  1023          #x: (#struct){
  1024            a: (#struct){
  1025              b: (int){ 1 }
  1026            }
  1027          }
  1028          #y: (#struct){
  1029            a: (#struct){
  1030              c: (int){ 2 }
  1031            }
  1032          }
  1033          b: (#struct){
  1034            x: (#struct){
  1035              a: (#struct){
  1036                b: (int){ 1 }
  1037                c: (int){ 2 }
  1038              }
  1039            }
  1040            zx: (#struct){
  1041              b: (int){ 1 }
  1042              c: (int){ 2 }
  1043            }
  1044          }
  1045          b1: (#struct){
  1046            d: (int){ 1 }
  1047            b: (int){ 1 }
  1048            c: (int){ 2 }
  1049          }
  1050        }
  1051      }
  1052      closed: (struct){
  1053        err1: (struct){
  1054          X: (struct){
  1055            a: (struct){
  1056              e: (int){ 1 }
  1057            }
  1058            b: (struct){
  1059            }
  1060          }
  1061          Y: (struct){
  1062            b: (#struct){
  1063            }
  1064            c: (#struct){
  1065            }
  1066            a: (struct){
  1067              e: (int){ 1 }
  1068            }
  1069          }
  1070          #X: (#struct){
  1071          }
  1072        }
  1073      }
  1074    }
  1075    nested: (_|_){
  1076      // [eval]
  1077      ok1: (struct){
  1078        #A: (#struct){
  1079          b: (#struct){
  1080          }
  1081          #B: (#struct){
  1082            c: (#struct){
  1083              d: (int){ 1 }
  1084            }
  1085          }
  1086        }
  1087        x: (#struct){
  1088          b: (#struct){
  1089          }
  1090          #B: (#struct){
  1091            c: (#struct){
  1092              d: (int){ 1 }
  1093            }
  1094          }
  1095        }
  1096      }
  1097      embed: (struct){
  1098        ok: (struct){
  1099          x: (#struct){
  1100            d: (#struct){
  1101              e: (int){ int }
  1102            }
  1103            b: (#struct){
  1104            }
  1105          }
  1106          #A: (#struct){
  1107            d: (#struct){
  1108              e: (int){ int }
  1109            }
  1110            b: (#struct){
  1111            }
  1112          }
  1113          k: (struct){
  1114            d: (struct){
  1115              e: (int){ int }
  1116            }
  1117            b: (struct){
  1118            }
  1119          }
  1120        }
  1121      }
  1122      err1: (_|_){
  1123        // [eval]
  1124        x: (_|_){
  1125          // [eval]
  1126          b: (_|_){
  1127            // [eval]
  1128            f: (_|_){
  1129              // [eval] nested.err1.x.b.f: field not allowed:
  1130              //     ./reroot.cue:114:6
  1131            }
  1132            g: (_|_){
  1133              // [eval] nested.err1.x.b.g: field not allowed:
  1134              //     ./reroot.cue:122:8
  1135            }
  1136          }
  1137          v: (_|_){
  1138            // [eval]
  1139            c: (_|_){
  1140              // [eval]
  1141              d: (_|_){
  1142                // [eval] nested.err1.x.#V.c.d: field not allowed:
  1143                //     ./reroot.cue:122:8
  1144                //     ./reroot.cue:118:5
  1145              }
  1146              f: (_|_){
  1147                // [eval] nested.err1.x.#V.c.f: field not allowed:
  1148                //     ./reroot.cue:122:8
  1149                //     ./reroot.cue:114:6
  1150              }
  1151              g: (int){ 1 }
  1152            }
  1153          }
  1154          #V: (_|_){
  1155            // [eval]
  1156            c: (_|_){
  1157              // [eval]
  1158              d: (_|_){
  1159                // [eval] nested.err1.x.#V.c.d: field not allowed:
  1160                //     ./reroot.cue:122:8
  1161                //     ./reroot.cue:118:5
  1162              }
  1163              f: (_|_){
  1164                // [eval] nested.err1.x.#V.c.f: field not allowed:
  1165                //     ./reroot.cue:122:8
  1166                //     ./reroot.cue:114:6
  1167              }
  1168              g: (int){ 1 }
  1169            }
  1170          }
  1171        }
  1172        #A: (#struct){
  1173          b: (#struct){
  1174            f: (int){ 1 }
  1175          }
  1176          v: (#struct){
  1177            c: (#struct){
  1178              d: (int){ 1 }
  1179              f: (int){ 1 }
  1180            }
  1181          }
  1182          #V: (#struct){
  1183            c: (#struct){
  1184              d: (int){ 1 }
  1185              f: (int){ 1 }
  1186            }
  1187          }
  1188        }
  1189        #B: (#struct){
  1190          g: (int){ 1 }
  1191        }
  1192      }
  1193      err2: (_|_){
  1194        // [eval]
  1195        #A: (#struct){
  1196          b: (#struct){
  1197          }
  1198          c: (#struct){
  1199            d: (int){ 1 }
  1200          }
  1201        }
  1202        x: (_|_){
  1203          // [eval]
  1204          b: (_|_){
  1205            // [eval]
  1206            g: (_|_){
  1207              // [eval] nested.err2.x.b.g: field not allowed:
  1208              //     ./reroot.cue:137:8
  1209            }
  1210          }
  1211          c: (#struct){
  1212            d: (int){ 1 }
  1213            g: (int){ 1 }
  1214          }
  1215        }
  1216      }
  1217    }
  1218    inline: (_|_){
  1219      // [eval]
  1220      #x: (#struct){
  1221        y: (#struct){
  1222          z?: (#struct){
  1223            name: (string){ string }
  1224          }
  1225        }
  1226      }
  1227      err1: (_|_){
  1228        // [eval]
  1229        name: (string){ "a" }
  1230        age1: (_|_){
  1231          // [eval] inline.err1.age1: field not allowed:
  1232          //     ./reroot.cue:143:8
  1233          //     ./reroot.cue:145:3
  1234        }
  1235      }
  1236      err2: (_|_){
  1237        // [eval]
  1238        name: (string){ "a" }
  1239        age2: (_|_){
  1240          // [eval] inline.err2.age2: field not allowed:
  1241          //     ./reroot.cue:147:8
  1242          //     ./reroot.cue:149:3
  1243        }
  1244      }
  1245    }
  1246    issue3332: (struct){
  1247      #def: (#struct){
  1248        field: (list){ list.MinItems(1) }
  1249      }
  1250      use: (#struct){
  1251        field: (#list){
  1252          0: (string){ "value" }
  1253        }
  1254      }
  1255    }
  1256  }
  1257  -- diff/-out/evalalpha<==>+out/eval --
  1258  diff old new
  1259  --- old
  1260  +++ new
  1261  @@ -1,66 +1,28 @@
  1262   Errors:
  1263  +nested.err1.x.b.f: field not allowed:
  1264  +    ./reroot.cue:114:6
  1265  +nested.err2.x.b.g: field not allowed:
  1266  +    ./reroot.cue:137:8
  1267   a.q.e: field not allowed:
  1268  -    ./in.cue:1:5
  1269  -    ./in.cue:6:5
  1270       ./in.cue:7:3
  1271  -    ./in.cue:11:4
  1272       ./in.cue:15:3
  1273  -indirect.closed.err1.Y.a.e: field not allowed:
  1274  -    ./reroot.cue:73:7
  1275  -    ./reroot.cue:74:7
  1276  -    ./reroot.cue:75:7
  1277  -    ./reroot.cue:77:6
  1278  -    ./reroot.cue:79:7
  1279  -    ./reroot.cue:80:7
  1280  -    ./reroot.cue:82:7
  1281   issue852.a.Foo: field not allowed:
  1282  -    ./in.cue:22:6
  1283  -    ./in.cue:26:5
  1284  +    ./in.cue:23:16
  1285       ./in.cue:28:5
  1286   nested.err1.x.#V.c.d: field not allowed:
  1287  -    ./reroot.cue:112:5
  1288  -    ./reroot.cue:114:6
  1289  -    ./reroot.cue:117:7
  1290  -    ./reroot.cue:118:5
  1291  -    ./reroot.cue:122:8
  1292  -    ./reroot.cue:123:6
  1293  +    ./reroot.cue:122:8
  1294  +    ./reroot.cue:118:5
  1295   nested.err1.x.#V.c.f: field not allowed:
  1296  -    ./reroot.cue:112:5
  1297  -    ./reroot.cue:114:6
  1298  -    ./reroot.cue:117:7
  1299  -    ./reroot.cue:117:11
  1300  -    ./reroot.cue:122:8
  1301  -    ./reroot.cue:123:6
  1302  -nested.err1.x.b.f: field not allowed:
  1303  -    ./reroot.cue:112:5
  1304  -    ./reroot.cue:114:6
  1305  -    ./reroot.cue:122:8
  1306  -    ./reroot.cue:123:6
  1307  +    ./reroot.cue:122:8
  1308  +    ./reroot.cue:114:6
  1309   nested.err1.x.b.g: field not allowed:
  1310  -    ./reroot.cue:112:5
  1311  -    ./reroot.cue:114:6
  1312  -    ./reroot.cue:122:8
  1313  -    ./reroot.cue:123:6
  1314  -nested.err1.x.v.c.d: field not allowed:
  1315  -    ./reroot.cue:112:5
  1316  -    ./reroot.cue:114:6
  1317  -    ./reroot.cue:115:6
  1318  -    ./reroot.cue:117:7
  1319  -    ./reroot.cue:118:5
  1320  -    ./reroot.cue:122:8
  1321  -    ./reroot.cue:123:6
  1322  -nested.err1.x.v.c.f: field not allowed:
  1323  -    ./reroot.cue:112:5
  1324  -    ./reroot.cue:114:6
  1325  -    ./reroot.cue:115:6
  1326  -    ./reroot.cue:117:7
  1327  -    ./reroot.cue:117:11
  1328  -    ./reroot.cue:122:8
  1329  -    ./reroot.cue:123:6
  1330  -nested.err2.x.b.g: field not allowed:
  1331  -    ./reroot.cue:128:6
  1332  -    ./reroot.cue:136:5
  1333  -    ./reroot.cue:137:8
  1334  +    ./reroot.cue:122:8
  1335  +inline.err1.age1: field not allowed:
  1336  +    ./reroot.cue:143:8
  1337  +    ./reroot.cue:145:3
  1338  +inline.err2.age2: field not allowed:
  1339  +    ./reroot.cue:147:8
  1340  +    ./reroot.cue:149:3
  1341   
  1342   Result:
  1343   (_|_){
  1344  @@ -76,13 +38,13 @@
  1345           }
  1346         }
  1347         #Extended: (#struct){
  1348  -        name: (string){ "base" }
  1349  -        type: (string){ "extended" }
  1350  -        items: (#struct){
  1351  -          "my-item": (#struct){
  1352  -            name: (string){ "my-item" }
  1353  -          }
  1354  -        }
  1355  +        type: (string){ "extended" }
  1356  +        items: (#struct){
  1357  +          "my-item": (#struct){
  1358  +            name: (string){ "my-item" }
  1359  +          }
  1360  +        }
  1361  +        name: (string){ "base" }
  1362         }
  1363         broken: (#struct){
  1364           name: (string){ "base" }
  1365  @@ -94,13 +56,13 @@
  1366           }
  1367         }
  1368         works: (#struct){
  1369  -        name: (string){ "base" }
  1370  -        type: (string){ "extended" }
  1371  -        items: (#struct){
  1372  -          "my-item": (#struct){
  1373  -            name: (string){ "my-item" }
  1374  -          }
  1375  -        }
  1376  +        type: (string){ "extended" }
  1377  +        items: (#struct){
  1378  +          "my-item": (#struct){
  1379  +            name: (string){ "my-item" }
  1380  +          }
  1381  +        }
  1382  +        name: (string){ "base" }
  1383         }
  1384       }
  1385     }
  1386  @@ -110,8 +72,8 @@
  1387     #A: (#struct){
  1388       b: (int){ int }
  1389       q: (#struct){
  1390  +      d: (int){ int }
  1391         c: (int){ int }
  1392  -      d: (int){ int }
  1393       }
  1394     }
  1395     a: (_|_){
  1396  @@ -120,21 +82,17 @@
  1397       q: (_|_){
  1398         // [eval]
  1399         c: (int){ 2 }
  1400  -      d: (int){ int }
  1401         e: (_|_){
  1402           // [eval] a.q.e: field not allowed:
  1403  -        //     ./in.cue:1:5
  1404  -        //     ./in.cue:6:5
  1405           //     ./in.cue:7:3
  1406  -        //     ./in.cue:11:4
  1407           //     ./in.cue:15:3
  1408         }
  1409  +      d: (int){ int }
  1410       }
  1411     }
  1412     issue852: (_|_){
  1413       // [eval] issue852.a.Foo: field not allowed:
  1414  -    //     ./in.cue:22:6
  1415  -    //     ./in.cue:26:5
  1416  +    //     ./in.cue:23:16
  1417       //     ./in.cue:28:5
  1418       #A: (#struct){
  1419       }
  1420  @@ -142,8 +100,7 @@
  1421         // [eval]
  1422         Foo: (_|_){
  1423           // [eval] issue852.a.Foo: field not allowed:
  1424  -        //     ./in.cue:22:6
  1425  -        //     ./in.cue:26:5
  1426  +        //     ./in.cue:23:16
  1427           //     ./in.cue:28:5
  1428         }
  1429       }
  1430  @@ -154,8 +111,8 @@
  1431         foo: (int){ int }
  1432       }
  1433       d: (#struct){
  1434  -      key: (string){ "foo" }
  1435         foo: (int){ 3 }
  1436  +      key: (string){ "foo" }
  1437       }
  1438     }
  1439     issue3330: (struct){
  1440  @@ -211,11 +168,11 @@
  1441             g: (#struct){
  1442             }
  1443           }
  1444  -        out2: (#struct){
  1445  -          field: (#struct){
  1446  -            n: (int){ 3 }
  1447  -          }
  1448  -          g: (#struct){
  1449  +        out2: (struct){
  1450  +          field: (struct){
  1451  +            n: (int){ 3 }
  1452  +          }
  1453  +          g: (struct){
  1454             }
  1455           }
  1456         }
  1457  @@ -261,8 +218,7 @@
  1458         }
  1459       }
  1460     }
  1461  -  indirect: (_|_){
  1462  -    // [eval]
  1463  +  indirect: (struct){
  1464       embed: (struct){
  1465         err1: (struct){
  1466           #A: (#struct){
  1467  @@ -299,17 +255,15 @@
  1468               c: (int){ 2 }
  1469             }
  1470           }
  1471  -        b1: (struct){
  1472  +        b1: (#struct){
  1473  +          d: (int){ 1 }
  1474             b: (int){ 1 }
  1475             c: (int){ 2 }
  1476  -          d: (int){ 1 }
  1477  -        }
  1478  -      }
  1479  -    }
  1480  -    closed: (_|_){
  1481  -      // [eval]
  1482  -      err1: (_|_){
  1483  -        // [eval]
  1484  +        }
  1485  +      }
  1486  +    }
  1487  +    closed: (struct){
  1488  +      err1: (struct){
  1489           X: (struct){
  1490             a: (struct){
  1491               e: (int){ 1 }
  1492  @@ -317,24 +271,13 @@
  1493             b: (struct){
  1494             }
  1495           }
  1496  -        Y: (_|_){
  1497  -          // [eval]
  1498  -          a: (_|_){
  1499  -            // [eval]
  1500  -            e: (_|_){
  1501  -              // [eval] indirect.closed.err1.Y.a.e: field not allowed:
  1502  -              //     ./reroot.cue:73:7
  1503  -              //     ./reroot.cue:74:7
  1504  -              //     ./reroot.cue:75:7
  1505  -              //     ./reroot.cue:77:6
  1506  -              //     ./reroot.cue:79:7
  1507  -              //     ./reroot.cue:80:7
  1508  -              //     ./reroot.cue:82:7
  1509  -            }
  1510  -          }
  1511  -          b: (#struct){
  1512  -          }
  1513  -          c: (#struct){
  1514  +        Y: (struct){
  1515  +          b: (#struct){
  1516  +          }
  1517  +          c: (#struct){
  1518  +          }
  1519  +          a: (struct){
  1520  +            e: (int){ 1 }
  1521             }
  1522           }
  1523           #X: (#struct){
  1524  @@ -397,17 +340,11 @@
  1525             // [eval]
  1526             f: (_|_){
  1527               // [eval] nested.err1.x.b.f: field not allowed:
  1528  -            //     ./reroot.cue:112:5
  1529  -            //     ./reroot.cue:114:6
  1530  -            //     ./reroot.cue:122:8
  1531  -            //     ./reroot.cue:123:6
  1532  +            //     ./reroot.cue:114:6
  1533             }
  1534             g: (_|_){
  1535               // [eval] nested.err1.x.b.g: field not allowed:
  1536  -            //     ./reroot.cue:112:5
  1537  -            //     ./reroot.cue:114:6
  1538  -            //     ./reroot.cue:122:8
  1539  -            //     ./reroot.cue:123:6
  1540  +            //     ./reroot.cue:122:8
  1541             }
  1542           }
  1543           v: (_|_){
  1544  @@ -414,27 +351,17 @@
  1545             // [eval]
  1546             c: (_|_){
  1547               // [eval]
  1548  -            f: (_|_){
  1549  -              // [eval] nested.err1.x.v.c.f: field not allowed:
  1550  -              //     ./reroot.cue:112:5
  1551  -              //     ./reroot.cue:114:6
  1552  -              //     ./reroot.cue:115:6
  1553  -              //     ./reroot.cue:117:7
  1554  -              //     ./reroot.cue:117:11
  1555  -              //     ./reroot.cue:122:8
  1556  -              //     ./reroot.cue:123:6
  1557  -            }
  1558  -            g: (int){ 1 }
  1559  -            d: (_|_){
  1560  -              // [eval] nested.err1.x.v.c.d: field not allowed:
  1561  -              //     ./reroot.cue:112:5
  1562  -              //     ./reroot.cue:114:6
  1563  -              //     ./reroot.cue:115:6
  1564  -              //     ./reroot.cue:117:7
  1565  -              //     ./reroot.cue:118:5
  1566  -              //     ./reroot.cue:122:8
  1567  -              //     ./reroot.cue:123:6
  1568  -            }
  1569  +            d: (_|_){
  1570  +              // [eval] nested.err1.x.#V.c.d: field not allowed:
  1571  +              //     ./reroot.cue:122:8
  1572  +              //     ./reroot.cue:118:5
  1573  +            }
  1574  +            f: (_|_){
  1575  +              // [eval] nested.err1.x.#V.c.f: field not allowed:
  1576  +              //     ./reroot.cue:122:8
  1577  +              //     ./reroot.cue:114:6
  1578  +            }
  1579  +            g: (int){ 1 }
  1580             }
  1581           }
  1582           #V: (_|_){
  1583  @@ -441,25 +368,17 @@
  1584             // [eval]
  1585             c: (_|_){
  1586               // [eval]
  1587  -            f: (_|_){
  1588  -              // [eval] nested.err1.x.#V.c.f: field not allowed:
  1589  -              //     ./reroot.cue:112:5
  1590  -              //     ./reroot.cue:114:6
  1591  -              //     ./reroot.cue:117:7
  1592  -              //     ./reroot.cue:117:11
  1593  -              //     ./reroot.cue:122:8
  1594  -              //     ./reroot.cue:123:6
  1595  -            }
  1596  -            g: (int){ 1 }
  1597  -            d: (_|_){
  1598  -              // [eval] nested.err1.x.#V.c.d: field not allowed:
  1599  -              //     ./reroot.cue:112:5
  1600  -              //     ./reroot.cue:114:6
  1601  -              //     ./reroot.cue:117:7
  1602  -              //     ./reroot.cue:118:5
  1603  -              //     ./reroot.cue:122:8
  1604  -              //     ./reroot.cue:123:6
  1605  -            }
  1606  +            d: (_|_){
  1607  +              // [eval] nested.err1.x.#V.c.d: field not allowed:
  1608  +              //     ./reroot.cue:122:8
  1609  +              //     ./reroot.cue:118:5
  1610  +            }
  1611  +            f: (_|_){
  1612  +              // [eval] nested.err1.x.#V.c.f: field not allowed:
  1613  +              //     ./reroot.cue:122:8
  1614  +              //     ./reroot.cue:114:6
  1615  +            }
  1616  +            g: (int){ 1 }
  1617             }
  1618           }
  1619         }
  1620  @@ -469,14 +388,14 @@
  1621           }
  1622           v: (#struct){
  1623             c: (#struct){
  1624  -            f: (int){ 1 }
  1625  -            d: (int){ 1 }
  1626  +            d: (int){ 1 }
  1627  +            f: (int){ 1 }
  1628             }
  1629           }
  1630           #V: (#struct){
  1631             c: (#struct){
  1632  -            f: (int){ 1 }
  1633  -            d: (int){ 1 }
  1634  +            d: (int){ 1 }
  1635  +            f: (int){ 1 }
  1636             }
  1637           }
  1638         }
  1639  @@ -499,19 +418,18 @@
  1640             // [eval]
  1641             g: (_|_){
  1642               // [eval] nested.err2.x.b.g: field not allowed:
  1643  -            //     ./reroot.cue:128:6
  1644  -            //     ./reroot.cue:136:5
  1645               //     ./reroot.cue:137:8
  1646             }
  1647           }
  1648           c: (#struct){
  1649  +          d: (int){ 1 }
  1650             g: (int){ 1 }
  1651  -          d: (int){ 1 }
  1652  -        }
  1653  -      }
  1654  -    }
  1655  -  }
  1656  -  inline: (struct){
  1657  +        }
  1658  +      }
  1659  +    }
  1660  +  }
  1661  +  inline: (_|_){
  1662  +    // [eval]
  1663       #x: (#struct){
  1664         y: (#struct){
  1665           z?: (#struct){
  1666  @@ -519,13 +437,23 @@
  1667           }
  1668         }
  1669       }
  1670  -    err1: (struct){
  1671  -      name: (string){ "a" }
  1672  -      age1: (int){ 5 }
  1673  -    }
  1674  -    err2: (struct){
  1675  -      name: (string){ "a" }
  1676  -      age2: (int){ 5 }
  1677  +    err1: (_|_){
  1678  +      // [eval]
  1679  +      name: (string){ "a" }
  1680  +      age1: (_|_){
  1681  +        // [eval] inline.err1.age1: field not allowed:
  1682  +        //     ./reroot.cue:143:8
  1683  +        //     ./reroot.cue:145:3
  1684  +      }
  1685  +    }
  1686  +    err2: (_|_){
  1687  +      // [eval]
  1688  +      name: (string){ "a" }
  1689  +      age2: (_|_){
  1690  +        // [eval] inline.err2.age2: field not allowed:
  1691  +        //     ./reroot.cue:147:8
  1692  +        //     ./reroot.cue:149:3
  1693  +      }
  1694       }
  1695     }
  1696     issue3332: (struct){
  1697  -- diff/todo/p2 --
  1698  Positions / reordering
  1699  
  1700  indirect.embed.b1.d: should be an error, but is not an error in either version.
  1701  -- diff/todo/p1 --
  1702  Should be an error, but are not:
  1703    indirect.closed.err1.Y.a.e
  1704    nested.err1.x.v.c.d
  1705    nested.err1.x.v.c.f
  1706  -- diff/explanation --
  1707  inline.err*.age*: fields are now correctly not allowed.
  1708  -- out/compile --
  1709  --- embed.cue
  1710  {
  1711    issue3325: {
  1712      ok: {
  1713        #Items: {
  1714          [string]: {
  1715            name: 〈1;-〉
  1716          }
  1717        }
  1718        #Base: {
  1719          name: "base"
  1720          type: string
  1721          items: 〈1;#Items〉
  1722        }
  1723        #Extended: (〈0;#Base〉 & {
  1724          type: "extended"
  1725          items: {
  1726            "my-item": {}
  1727          }
  1728        })
  1729        broken: {
  1730          〈1;#Base〉
  1731          〈1;#Extended〉
  1732        }
  1733        works: {
  1734          〈1;#Extended〉
  1735          〈1;#Base〉
  1736        }
  1737      }
  1738    }
  1739  }
  1740  --- in.cue
  1741  {
  1742    #E: {
  1743      c: int
  1744    }
  1745    #A: {
  1746      b: int
  1747      q: {
  1748        〈2;#E〉
  1749        d: int
  1750      }
  1751    }
  1752    a: (〈0;#A〉 & {
  1753      b: 3
  1754      q: {
  1755        c: 2
  1756        e: 43
  1757      }
  1758    })
  1759    issue852: {
  1760      #A: {
  1761        [=~"^a-z$"]: string
  1762      }
  1763      a: 〈0;#A〉
  1764      a: {
  1765        Foo: "foo"
  1766      }
  1767      for k, v in 〈0;a〉 {
  1768        b: {
  1769          "\(〈2;k〉)": 〈2;v〉
  1770        }
  1771      }
  1772    }
  1773    dynamic: {
  1774      #D: {
  1775        key: "foo"
  1776        〈0;key〉: int
  1777      }
  1778      d: (〈0;#D〉 & {
  1779        foo: 3
  1780      })
  1781    }
  1782  }
  1783  --- reroot.cue
  1784  {
  1785    issue3330: {
  1786      let: {
  1787        ok: {
  1788          #struct: {
  1789            let empty#1 = {}
  1790            field: (null|{
  1791              n: int
  1792            })
  1793            field: (〈0;let empty#1〉 & {
  1794              n: 3
  1795            })
  1796          }
  1797          out: 〈import;list〉.Concat([
  1798            [
  1799              〈2;#struct〉,
  1800            ],
  1801          ])
  1802        }
  1803      }
  1804      matthew: {
  1805        ok1: {
  1806          #struct: {
  1807            field: ({
  1808              n: 3
  1809            } & 〈0;g〉)
  1810            g: {}
  1811          }
  1812          out: (〈0;#struct〉 & {})
  1813        }
  1814      }
  1815      matthew: {
  1816        ok2: {
  1817          #struct: {
  1818            field: ({
  1819              n: 3
  1820            } & 〈0;g〉)
  1821            g: {}
  1822          }
  1823          out: 〈0;#struct〉
  1824          out2: (〈0;out〉 & {})
  1825        }
  1826      }
  1827    }
  1828    issue3331: {
  1829      original: {
  1830        ok: {
  1831          #A: {
  1832            let b#2 = {}
  1833            c: (〈0;let b#2〉 & {
  1834              d: 1
  1835            })
  1836          }
  1837          〈import;list〉.Concat([
  1838            [
  1839              〈2;#A〉,
  1840            ],
  1841          ])
  1842        }
  1843      }
  1844      variant1: {
  1845        ok: {
  1846          #A: {
  1847            let b#3 = {}
  1848            c: (〈0;let b#3〉 & {
  1849              d: 1
  1850            })
  1851          }
  1852          [
  1853            [
  1854              〈2;#A〉,
  1855            ],
  1856          ]
  1857        }
  1858      }
  1859    }
  1860    indirect: {
  1861      embed: {
  1862        err1: {
  1863          #A: {
  1864            x: {
  1865              〈2;#x〉
  1866              〈2;#y〉
  1867            }
  1868            zx: 〈0;x〉.a
  1869          }
  1870          #x: {
  1871            a: {
  1872              b: 1
  1873            }
  1874          }
  1875          #y: {
  1876            a: {
  1877              c: 2
  1878            }
  1879          }
  1880          b: 〈0;#A〉
  1881          b1: 〈0;b〉.zx
  1882          b1: {
  1883            d: 1
  1884          }
  1885        }
  1886      }
  1887      closed: {
  1888        err1: {
  1889          X: {
  1890            a: 〈0;b〉
  1891            b: {}
  1892            a: {
  1893              e: 1
  1894            }
  1895          }
  1896          Y: 〈0;X〉
  1897          Y: {
  1898            b: 〈0;c〉
  1899            c: 〈1;#X〉
  1900          }
  1901          #X: {}
  1902        }
  1903      }
  1904    }
  1905    nested: {
  1906      ok1: {
  1907        #A: {
  1908          b: {}
  1909          #B: {
  1910            c: (〈1;b〉 & {
  1911              d: 1
  1912            })
  1913          }
  1914        }
  1915        x: 〈0;#A〉
  1916      }
  1917    }
  1918    nested: {
  1919      embed: {
  1920        ok: {
  1921          x: 〈0;#A〉
  1922          #A: {
  1923            〈1;k〉
  1924          }
  1925          k: {
  1926            d: (〈0;b〉 & {
  1927              e: int
  1928            })
  1929            b: {}
  1930          }
  1931        }
  1932      }
  1933    }
  1934    nested: {
  1935      err1: {
  1936        x: 〈0;#A〉
  1937        #A: {
  1938          b: {
  1939            f: 1
  1940          }
  1941          v: 〈0;#V〉
  1942          #V: {
  1943            c: (〈1;b〉 & {
  1944              d: 1
  1945            })
  1946          }
  1947        }
  1948        x: {
  1949          b: 〈1;#B〉
  1950        }
  1951        #B: {
  1952          g: 1
  1953        }
  1954      }
  1955    }
  1956    nested: {
  1957      err2: {
  1958        #A: {
  1959          b: {}
  1960          c: (〈0;b〉 & {
  1961            d: 1
  1962          })
  1963        }
  1964        x: 〈0;#A〉
  1965        x: {
  1966          b: {
  1967            g: 1
  1968          }
  1969        }
  1970      }
  1971    }
  1972    inline: {
  1973      #x: {
  1974        y: {
  1975          z?: {
  1976            name: string
  1977          }
  1978        }
  1979      }
  1980      err1: ((〈0;#x〉 & {
  1981        y: {
  1982          z: _
  1983        }
  1984      }).y.z & {
  1985        name: "a"
  1986        age1: 5
  1987      })
  1988      err2: ((〈0;#x〉.y & {
  1989        z: _
  1990      }).z & {
  1991        name: "a"
  1992        age2: 5
  1993      })
  1994    }
  1995  }
  1996  --- validation.cue
  1997  {
  1998    issue3332: {
  1999      #def: {
  2000        field: 〈import;list〉.MinItems(1)
  2001      }
  2002      use: (〈0;#def〉 & {
  2003        field: [
  2004          "value",
  2005        ]
  2006      })
  2007    }
  2008  }