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

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