cuelang.org/go@v0.13.0/cue/testdata/fulleval/050_json_Marshaling_detects_incomplete.txtar (about)

     1  #name: json Marshaling detects incomplete
     2  #evalFull
     3  -- in.cue --
     4  import "encoding/json"
     5  
     6  a: json.Marshal({a: string})
     7  
     8  foo: {a: 3, b: foo.c}
     9  b: json.Marshal(foo)
    10  -- out/def --
    11  import "encoding/json"
    12  
    13  a: json.Marshal({
    14  	a: string
    15  })
    16  foo: {
    17  	a: 3
    18  	b: foo.c
    19  }
    20  b: json.Marshal(foo)
    21  -- out/legacy-debug --
    22  <0>{a: <1>.Marshal (<2>{a: string}), foo: <3>{a: 3, b: <4>.foo.c}, b: <1>.Marshal (<4>.foo)}
    23  -- out/evalalpha/stats --
    24  Leaks:  8
    25  Freed:  0
    26  Reused: 0
    27  Allocs: 8
    28  Retain: 0
    29  
    30  Unifications: 8
    31  Conjuncts:    8
    32  Disjuncts:    0
    33  -- diff/-out/evalalpha/stats<==>+out/eval/stats --
    34  diff old new
    35  --- old
    36  +++ new
    37  @@ -1,9 +1,9 @@
    38  -Leaks:  0
    39  -Freed:  16
    40  -Reused: 12
    41  -Allocs: 4
    42  -Retain: 5
    43  +Leaks:  8
    44  +Freed:  0
    45  +Reused: 0
    46  +Allocs: 8
    47  +Retain: 0
    48   
    49  -Unifications: 16
    50  -Conjuncts:    24
    51  -Disjuncts:    21
    52  +Unifications: 8
    53  +Conjuncts:    8
    54  +Disjuncts:    0
    55  -- out/eval/stats --
    56  Leaks:  0
    57  Freed:  16
    58  Reused: 12
    59  Allocs: 4
    60  Retain: 5
    61  
    62  Unifications: 16
    63  Conjuncts:    24
    64  Disjuncts:    21
    65  -- out/eval --
    66  (struct){
    67    a: (_|_){
    68      // [incomplete] cannot convert incomplete value "string" to JSON:
    69      //     ./in.cue:3:21
    70    }
    71    foo: (struct){
    72      a: (int){ 3 }
    73      b: (_|_){
    74        // [incomplete] foo.b: undefined field: c:
    75        //     ./in.cue:5:20
    76      }
    77    }
    78    b: (_|_){
    79      // [incomplete] foo.b: undefined field: c:
    80      //     ./in.cue:5:20
    81    }
    82  }
    83  -- out/compile --
    84  --- in.cue
    85  {
    86    a: 〈import;"encoding/json"〉.Marshal({
    87      a: string
    88    })
    89    foo: {
    90      a: 3
    91      b: 〈1;foo〉.c
    92    }
    93    b: 〈import;"encoding/json"〉.Marshal(〈0;foo〉)
    94  }