cuelang.org/go@v0.10.1/cue/testdata/definitions/036_closing_with_failed_optional.txtar (about)

     1  # DO NOT EDIT; generated by go run testdata/gen.go
     2  #
     3  #name: closing with failed optional
     4  #evalPartial
     5  -- in.cue --
     6  #k1: {a: int, b?: int} & #A // closed({a: int})
     7  
     8  #k2: #A & {a: int, b?: int} // closed({a: int})
     9  
    10  o1: {a?: 3} & {a?: 4} // {a?: _|_}
    11  
    12  // Optional fields with error values can be elimintated when closing
    13  #o2: {a?: 3} & {a?: 4} // close({})
    14  
    15  #d1: {a?: 2, b: 4} | {a?: 3, c: 5}
    16  
    17  v1: #d1 & {a?: 3, b: 4} // close({b: 4})
    18  
    19  #A: {a: int}
    20  -- out/def --
    21  #k1: {
    22  	a:  int
    23  	b?: int
    24  } & #A
    25  #A: {
    26  	a: int
    27  }
    28  #k2: #A & {
    29  	a:  int
    30  	b?: int
    31  }
    32  o1: {
    33  	a?: _|_ // conflicting values 3 and 4
    34  }
    35  
    36  // Optional fields with error values can be elimintated when closing
    37  #o2: {
    38  	a?: _|_ // conflicting values 3 and 4
    39  }
    40  #d1: {
    41  	a?: 2
    42  	b:  4
    43  } | {
    44  	a?: 3
    45  	c:  5
    46  }
    47  v1: #d1 & {
    48  	a?: 3
    49  	b:  4
    50  }
    51  -- out/export --
    52  o1: {}
    53  v1: {
    54  	b: 4
    55  }
    56  -- out/yaml --
    57  o1: {}
    58  v1:
    59    b: 4
    60  -- out/json --
    61  {"o1":{},"v1":{"b":4}}
    62  -- out/legacy-debug --
    63  <0>{#k1: <1>C{a: int}, #A: <2>C{a: int}, #k2: <3>C{a: int}, o1: <4>{a?: _|_((3 & 4):conflicting values 3 and 4)}, #o2: <5>C{a?: _|_((3 & 4):conflicting values 3 and 4)}, #d1: (<6>C{a?: 2, b: 4} | <7>C{a?: 3, c: 5}), v1: <8>C{a?: _|_((2 & 3):conflicting values 2 and 3), b: 4}}
    64  -- out/compile --
    65  --- in.cue
    66  {
    67    #k1: ({
    68      a: int
    69      b?: int
    70    } & 〈0;#A〉)
    71    #k2: (〈0;#A〉 & {
    72      a: int
    73      b?: int
    74    })
    75    o1: ({
    76      a?: 3
    77    } & {
    78      a?: 4
    79    })
    80    #o2: ({
    81      a?: 3
    82    } & {
    83      a?: 4
    84    })
    85    #d1: ({
    86      a?: 2
    87      b: 4
    88    }|{
    89      a?: 3
    90      c: 5
    91    })
    92    v1: (〈0;#d1〉 & {
    93      a?: 3
    94      b: 4
    95    })
    96    #A: {
    97      a: int
    98    }
    99  }
   100  -- out/eval/stats --
   101  Leaks:  0
   102  Freed:  28
   103  Reused: 23
   104  Allocs: 5
   105  Retain: 1
   106  
   107  Unifications: 24
   108  Conjuncts:    43
   109  Disjuncts:    29
   110  -- out/evalalpha --
   111  (struct){
   112    #k1: (#struct){
   113      a: (int){ int }
   114      b?: (int){ int }
   115    }
   116    #k2: (#struct){
   117      a: (int){ int }
   118      b?: (int){ int }
   119    }
   120    o1: (struct){
   121      a?: (_|_){
   122        // [eval] o1.a: conflicting values 4 and 3:
   123        //     ./in.cue:5:10
   124        //     ./in.cue:5:20
   125      }
   126    }
   127    #o2: (#struct){
   128      a?: (_|_){
   129        // [eval] #o2.a: conflicting values 4 and 3:
   130        //     ./in.cue:8:11
   131        //     ./in.cue:8:21
   132      }
   133    }
   134    #d1: (#struct){ |((#struct){
   135        a?: (int){ 2 }
   136        b: (int){ 4 }
   137      }, (#struct){
   138        a?: (int){ 3 }
   139        c: (int){ 5 }
   140      }) }
   141    v1: (#struct){
   142      a?: (_|_){
   143        // [eval] v1.a: conflicting values 2 and 3:
   144        //     ./in.cue:10:11
   145        //     ./in.cue:12:16
   146      }
   147      b: (int){ 4 }
   148    }
   149    #A: (#struct){
   150      a: (int){ int }
   151    }
   152  }
   153  -- diff/-out/evalalpha<==>+out/eval --
   154  diff old new
   155  --- old
   156  +++ new
   157  @@ -32,7 +32,6 @@
   158       a?: (_|_){
   159         // [eval] v1.a: conflicting values 2 and 3:
   160         //     ./in.cue:10:11
   161  -      //     ./in.cue:12:5
   162         //     ./in.cue:12:16
   163       }
   164       b: (int){ 4 }
   165  -- diff/todo/p2 --
   166  v1.a: Incorrect path in error message.
   167  -- diff/todo/p3 --
   168  Missing error position.
   169  -- out/eval --
   170  (struct){
   171    #k1: (#struct){
   172      a: (int){ int }
   173      b?: (int){ int }
   174    }
   175    #k2: (#struct){
   176      a: (int){ int }
   177      b?: (int){ int }
   178    }
   179    o1: (struct){
   180      a?: (_|_){
   181        // [eval] o1.a: conflicting values 4 and 3:
   182        //     ./in.cue:5:10
   183        //     ./in.cue:5:20
   184      }
   185    }
   186    #o2: (#struct){
   187      a?: (_|_){
   188        // [eval] #o2.a: conflicting values 4 and 3:
   189        //     ./in.cue:8:11
   190        //     ./in.cue:8:21
   191      }
   192    }
   193    #d1: (#struct){ |((#struct){
   194        a?: (int){ 2 }
   195        b: (int){ 4 }
   196      }, (#struct){
   197        a?: (int){ 3 }
   198        c: (int){ 5 }
   199      }) }
   200    v1: (#struct){
   201      a?: (_|_){
   202        // [eval] v1.a: conflicting values 2 and 3:
   203        //     ./in.cue:10:11
   204        //     ./in.cue:12:5
   205        //     ./in.cue:12:16
   206      }
   207      b: (int){ 4 }
   208    }
   209    #A: (#struct){
   210      a: (int){ int }
   211    }
   212  }