...

Text file src/cuelang.org/go/cue/testdata/definitions/issue320.txtar

Documentation: cuelang.org/go/cue/testdata/definitions

     1-- in.cue --
     2#Foo: {
     3	x: string
     4	#More
     5}
     6
     7#More: [=~"^x-"]: _
     8
     9foo: #Foo & {
    10	x: "hello"
    11	y: "goodbye"
    12}
    13-- out/eval/stats --
    14Leaks:  0
    15Freed:  7
    16Reused: 4
    17Allocs: 3
    18Retain: 1
    19
    20Unifications: 7
    21Conjuncts:    14
    22Disjuncts:    8
    23-- out/evalalpha --
    24Errors:
    25foo.y: field not allowed:
    26    ./in.cue:6:19
    27    ./in.cue:10:2
    28
    29Result:
    30(_|_){
    31  // [eval]
    32  #Foo: (#struct){
    33    x: (string){ string }
    34  }
    35  #More: (#struct){
    36  }
    37  foo: (_|_){
    38    // [eval]
    39    x: (string){ "hello" }
    40    y: (_|_){
    41      // [eval] foo.y: field not allowed:
    42      //     ./in.cue:6:19
    43      //     ./in.cue:10:2
    44    }
    45  }
    46}
    47-- diff/-out/evalalpha<==>+out/eval --
    48diff old new
    49--- old
    50+++ new
    51@@ -1,9 +1,6 @@
    52 Errors:
    53 foo.y: field not allowed:
    54-    ./in.cue:1:7
    55-    ./in.cue:3:2
    56-    ./in.cue:6:8
    57-    ./in.cue:8:6
    58+    ./in.cue:6:19
    59     ./in.cue:10:2
    60 
    61 Result:
    62@@ -19,10 +16,7 @@
    63     x: (string){ "hello" }
    64     y: (_|_){
    65       // [eval] foo.y: field not allowed:
    66-      //     ./in.cue:1:7
    67-      //     ./in.cue:3:2
    68-      //     ./in.cue:6:8
    69-      //     ./in.cue:8:6
    70+      //     ./in.cue:6:19
    71       //     ./in.cue:10:2
    72     }
    73   }
    74-- diff/todo/p2 --
    75Positions.
    76-- out/eval --
    77Errors:
    78foo.y: field not allowed:
    79    ./in.cue:1:7
    80    ./in.cue:3:2
    81    ./in.cue:6:8
    82    ./in.cue:8:6
    83    ./in.cue:10:2
    84
    85Result:
    86(_|_){
    87  // [eval]
    88  #Foo: (#struct){
    89    x: (string){ string }
    90  }
    91  #More: (#struct){
    92  }
    93  foo: (_|_){
    94    // [eval]
    95    x: (string){ "hello" }
    96    y: (_|_){
    97      // [eval] foo.y: field not allowed:
    98      //     ./in.cue:1:7
    99      //     ./in.cue:3:2
   100      //     ./in.cue:6:8
   101      //     ./in.cue:8:6
   102      //     ./in.cue:10:2
   103    }
   104  }
   105}
   106-- out/compile --
   107--- in.cue
   108{
   109  #Foo: {
   110    x: string
   111    〈1;#More〉
   112  }
   113  #More: {
   114    [=~"^x-"]: _
   115  }
   116  foo: (〈0;#Foo〉 & {
   117    x: "hello"
   118    y: "goodbye"
   119  })
   120}

View as plain text