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

     1  -- in.cue --
     2  deployment: [string]: #Deployment
     3  
     4  deployment: foo: spec: replicas: 1
     5  
     6  #Deployment: {
     7  	#TypeMeta
     8  
     9  	spec: #Spec
    10  }
    11  
    12  #Spec: replicas: int
    13  
    14  #TypeMeta: {}
    15  
    16  recloseSimple: {
    17  	#foo: {}
    18  	a: {#foo} & {b: int}
    19  }
    20  
    21  // Reclosing
    22  reclose1: {
    23  	#D: {
    24  		x: int
    25  		y: int
    26  	}
    27  	#a: {
    28  		#D
    29  		b: {
    30  			c: int
    31  		}
    32  	}
    33  
    34  	z: #a.b
    35  	z: d: 3 // don't allow this
    36  }
    37  
    38  reclose2: {
    39  	#D: {
    40  		x: int
    41  		y: int
    42  	}
    43  	a: {
    44  		#D
    45  		b: {// keep open
    46  			c: int
    47  		}
    48  	}
    49  
    50  	z: a.b
    51  	z: d: 3 // allow this
    52  }
    53  
    54  reclose3: {
    55  	#Step: {
    56  		(#A | #B)
    57  		#Common
    58  	}
    59  	#Common: {
    60  		Name: string
    61  	}
    62  	#A: {
    63  		#Common
    64  		Something: int
    65  	}
    66  	#B: {
    67  		#Common
    68  		Else: int
    69  	}
    70  	x: #Step
    71  	x: #A & {
    72  		Name:      "a"
    73  		Something: 4
    74  	}
    75  }
    76  -- out/eval/stats --
    77  Leaks:  0
    78  Freed:  63
    79  Reused: 56
    80  Allocs: 7
    81  Retain: 6
    82  
    83  Unifications: 59
    84  Conjuncts:    124
    85  Disjuncts:    69
    86  -- out/evalalpha --
    87  Errors:
    88  recloseSimple.a.b: field not allowed:
    89      ./in.cue:17:6
    90      ./in.cue:17:15
    91  reclose1.z.d: field not allowed:
    92      ./in.cue:33:5
    93      ./in.cue:34:5
    94  
    95  Result:
    96  (_|_){
    97    // [eval]
    98    deployment: (struct){
    99      foo: (#struct){
   100        spec: (#struct){
   101          replicas: (int){ 1 }
   102        }
   103      }
   104    }
   105    #Deployment: (#struct){
   106      spec: (#struct){
   107        replicas: (int){ int }
   108      }
   109    }
   110    #Spec: (#struct){
   111      replicas: (int){ int }
   112    }
   113    #TypeMeta: (#struct){
   114    }
   115    recloseSimple: (_|_){
   116      // [eval]
   117      #foo: (#struct){
   118      }
   119      a: (_|_){
   120        // [eval]
   121        b: (_|_){
   122          // [eval] recloseSimple.a.b: field not allowed:
   123          //     ./in.cue:17:6
   124          //     ./in.cue:17:15
   125        }
   126      }
   127    }
   128    reclose1: (_|_){
   129      // [eval]
   130      #D: (#struct){
   131        x: (int){ int }
   132        y: (int){ int }
   133      }
   134      #a: (#struct){
   135        b: (#struct){
   136          c: (int){ int }
   137        }
   138        x: (int){ int }
   139        y: (int){ int }
   140      }
   141      z: (_|_){
   142        // [eval]
   143        d: (_|_){
   144          // [eval] reclose1.z.d: field not allowed:
   145          //     ./in.cue:33:5
   146          //     ./in.cue:34:5
   147        }
   148        c: (int){ int }
   149      }
   150    }
   151    reclose2: (struct){
   152      #D: (#struct){
   153        x: (int){ int }
   154        y: (int){ int }
   155      }
   156      a: (#struct){
   157        b: (struct){
   158          c: (int){ int }
   159        }
   160        x: (int){ int }
   161        y: (int){ int }
   162      }
   163      z: (struct){
   164        d: (int){ 3 }
   165        c: (int){ int }
   166      }
   167    }
   168    reclose3: (struct){
   169      #Step: (#struct){ |((#struct){
   170          Name: (string){ string }
   171          Something: (int){ int }
   172        }, (#struct){
   173          Name: (string){ string }
   174          Else: (int){ int }
   175        }) }
   176      #Common: (#struct){
   177        Name: (string){ string }
   178      }
   179      #A: (#struct){
   180        Something: (int){ int }
   181        Name: (string){ string }
   182      }
   183      #B: (#struct){
   184        Else: (int){ int }
   185        Name: (string){ string }
   186      }
   187      x: (#struct){
   188        Name: (string){ "a" }
   189        Something: (int){ 4 }
   190      }
   191    }
   192  }
   193  -- diff/-out/evalalpha<==>+out/eval --
   194  diff old new
   195  --- old
   196  +++ new
   197  @@ -1,13 +1,10 @@
   198   Errors:
   199  -reclose1.z.d: field not allowed:
   200  -    ./in.cue:28:6
   201  -    ./in.cue:33:5
   202  -    ./in.cue:34:5
   203   recloseSimple.a.b: field not allowed:
   204  -    ./in.cue:16:8
   205  -    ./in.cue:17:5
   206       ./in.cue:17:6
   207       ./in.cue:17:15
   208  +reclose1.z.d: field not allowed:
   209  +    ./in.cue:33:5
   210  +    ./in.cue:34:5
   211   
   212   Result:
   213   (_|_){
   214  @@ -37,8 +34,6 @@
   215         // [eval]
   216         b: (_|_){
   217           // [eval] recloseSimple.a.b: field not allowed:
   218  -        //     ./in.cue:16:8
   219  -        //     ./in.cue:17:5
   220           //     ./in.cue:17:6
   221           //     ./in.cue:17:15
   222         }
   223  @@ -51,21 +46,20 @@
   224         y: (int){ int }
   225       }
   226       #a: (#struct){
   227  -      x: (int){ int }
   228  -      y: (int){ int }
   229         b: (#struct){
   230           c: (int){ int }
   231         }
   232  +      x: (int){ int }
   233  +      y: (int){ int }
   234       }
   235       z: (_|_){
   236         // [eval]
   237  -      c: (int){ int }
   238         d: (_|_){
   239           // [eval] reclose1.z.d: field not allowed:
   240  -        //     ./in.cue:28:6
   241           //     ./in.cue:33:5
   242           //     ./in.cue:34:5
   243         }
   244  +      c: (int){ int }
   245       }
   246     }
   247     reclose2: (struct){
   248  @@ -74,15 +68,15 @@
   249         y: (int){ int }
   250       }
   251       a: (#struct){
   252  -      x: (int){ int }
   253  -      y: (int){ int }
   254         b: (struct){
   255           c: (int){ int }
   256         }
   257  +      x: (int){ int }
   258  +      y: (int){ int }
   259       }
   260       z: (struct){
   261  -      c: (int){ int }
   262         d: (int){ 3 }
   263  +      c: (int){ int }
   264       }
   265     }
   266     reclose3: (struct){
   267  @@ -97,12 +91,12 @@
   268         Name: (string){ string }
   269       }
   270       #A: (#struct){
   271  -      Name: (string){ string }
   272         Something: (int){ int }
   273  +      Name: (string){ string }
   274       }
   275       #B: (#struct){
   276  -      Name: (string){ string }
   277         Else: (int){ int }
   278  +      Name: (string){ string }
   279       }
   280       x: (#struct){
   281         Name: (string){ "a" }
   282  -- diff/todo/p3 --
   283  Reordering
   284  Missing error positions
   285  -- out/eval --
   286  Errors:
   287  reclose1.z.d: field not allowed:
   288      ./in.cue:28:6
   289      ./in.cue:33:5
   290      ./in.cue:34:5
   291  recloseSimple.a.b: field not allowed:
   292      ./in.cue:16:8
   293      ./in.cue:17:5
   294      ./in.cue:17:6
   295      ./in.cue:17:15
   296  
   297  Result:
   298  (_|_){
   299    // [eval]
   300    deployment: (struct){
   301      foo: (#struct){
   302        spec: (#struct){
   303          replicas: (int){ 1 }
   304        }
   305      }
   306    }
   307    #Deployment: (#struct){
   308      spec: (#struct){
   309        replicas: (int){ int }
   310      }
   311    }
   312    #Spec: (#struct){
   313      replicas: (int){ int }
   314    }
   315    #TypeMeta: (#struct){
   316    }
   317    recloseSimple: (_|_){
   318      // [eval]
   319      #foo: (#struct){
   320      }
   321      a: (_|_){
   322        // [eval]
   323        b: (_|_){
   324          // [eval] recloseSimple.a.b: field not allowed:
   325          //     ./in.cue:16:8
   326          //     ./in.cue:17:5
   327          //     ./in.cue:17:6
   328          //     ./in.cue:17:15
   329        }
   330      }
   331    }
   332    reclose1: (_|_){
   333      // [eval]
   334      #D: (#struct){
   335        x: (int){ int }
   336        y: (int){ int }
   337      }
   338      #a: (#struct){
   339        x: (int){ int }
   340        y: (int){ int }
   341        b: (#struct){
   342          c: (int){ int }
   343        }
   344      }
   345      z: (_|_){
   346        // [eval]
   347        c: (int){ int }
   348        d: (_|_){
   349          // [eval] reclose1.z.d: field not allowed:
   350          //     ./in.cue:28:6
   351          //     ./in.cue:33:5
   352          //     ./in.cue:34:5
   353        }
   354      }
   355    }
   356    reclose2: (struct){
   357      #D: (#struct){
   358        x: (int){ int }
   359        y: (int){ int }
   360      }
   361      a: (#struct){
   362        x: (int){ int }
   363        y: (int){ int }
   364        b: (struct){
   365          c: (int){ int }
   366        }
   367      }
   368      z: (struct){
   369        c: (int){ int }
   370        d: (int){ 3 }
   371      }
   372    }
   373    reclose3: (struct){
   374      #Step: (#struct){ |((#struct){
   375          Name: (string){ string }
   376          Something: (int){ int }
   377        }, (#struct){
   378          Name: (string){ string }
   379          Else: (int){ int }
   380        }) }
   381      #Common: (#struct){
   382        Name: (string){ string }
   383      }
   384      #A: (#struct){
   385        Name: (string){ string }
   386        Something: (int){ int }
   387      }
   388      #B: (#struct){
   389        Name: (string){ string }
   390        Else: (int){ int }
   391      }
   392      x: (#struct){
   393        Name: (string){ "a" }
   394        Something: (int){ 4 }
   395      }
   396    }
   397  }
   398  -- out/compile --
   399  --- in.cue
   400  {
   401    deployment: {
   402      [string]: 〈1;#Deployment〉
   403    }
   404    deployment: {
   405      foo: {
   406        spec: {
   407          replicas: 1
   408        }
   409      }
   410    }
   411    #Deployment: {
   412      〈1;#TypeMeta〉
   413      spec: 〈1;#Spec〉
   414    }
   415    #Spec: {
   416      replicas: int
   417    }
   418    #TypeMeta: {}
   419    recloseSimple: {
   420      #foo: {}
   421      a: ({
   422        〈1;#foo〉
   423      } & {
   424        b: int
   425      })
   426    }
   427    reclose1: {
   428      #D: {
   429        x: int
   430        y: int
   431      }
   432      #a: {
   433        〈1;#D〉
   434        b: {
   435          c: int
   436        }
   437      }
   438      z: 〈0;#a〉.b
   439      z: {
   440        d: 3
   441      }
   442    }
   443    reclose2: {
   444      #D: {
   445        x: int
   446        y: int
   447      }
   448      a: {
   449        〈1;#D〉
   450        b: {
   451          c: int
   452        }
   453      }
   454      z: 〈0;a〉.b
   455      z: {
   456        d: 3
   457      }
   458    }
   459    reclose3: {
   460      #Step: {
   461        (〈1;#A〉|〈1;#B〉)
   462        〈1;#Common〉
   463      }
   464      #Common: {
   465        Name: string
   466      }
   467      #A: {
   468        〈1;#Common〉
   469        Something: int
   470      }
   471      #B: {
   472        〈1;#Common〉
   473        Else: int
   474      }
   475      x: 〈0;#Step〉
   476      x: (〈0;#A〉 & {
   477        Name: "a"
   478        Something: 4
   479      })
   480    }
   481  }