...

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

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

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

View as plain text