...

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

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

     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
    10o1: {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
    17v1: #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}
    32o1: {
    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}
    47v1: #d1 & {
    48	a?: 3
    49	b:  4
    50}
    51-- out/export --
    52o1: {}
    53v1: {
    54	b: 4
    55}
    56-- out/yaml --
    57o1: {}
    58v1:
    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 --
   101Leaks:  0
   102Freed:  28
   103Reused: 23
   104Allocs: 5
   105Retain: 1
   106
   107Unifications: 24
   108Conjuncts:    43
   109Disjuncts:    29
   110-- out/eval --
   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:5
   146      //     ./in.cue:12:16
   147    }
   148    b: (int){ 4 }
   149  }
   150  #A: (#struct){
   151    a: (int){ int }
   152  }
   153}

View as plain text