...

Text file src/cuelang.org/go/cue/testdata/eval/fields.txtar

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

     1-- in.cue --
     2bulkToSelf: {
     3	a: {
     4		foo: [string]: int
     5		foo: bar:      "3" // error
     6	}
     7}
     8intField: {
     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 --
    29Leaks:  0
    30Freed:  7
    31Reused: 2
    32Allocs: 5
    33Retain: 0
    34
    35Unifications: 7
    36Conjuncts:    9
    37Disjuncts:    7
    38-- out/evalalpha --
    39Errors:
    40bulkToSelf.a.foo.bar: conflicting values "3" and int (mismatched types string and int):
    41    ./in.cue:3:18
    42    ./in.cue:4:18
    43intField: integer fields not supported:
    44    ./in.cue:8:3
    45
    46Result:
    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 --
    69diff 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 --
    80Not including illegal field. Seems fine.
    81-- out/eval --
    82Errors:
    83bulkToSelf.a.foo.bar: conflicting values "3" and int (mismatched types string and int):
    84    ./in.cue:3:18
    85    ./in.cue:4:18
    86intField: integer fields not supported:
    87    ./in.cue:8:3
    88
    89Result:
    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}

View as plain text