github.com/solo-io/cue@v0.4.7/cue/testdata/definitions/037_conjunction_of_optional_sets.txtar (about)

     1  # DO NOT EDIT; generated by go run testdata/gen.go
     2  #
     3  #name: conjunction of optional sets
     4  #evalFull
     5  -- in.cue --
     6  #A: {
     7  	[=~"^[a-s]*$"]: int
     8  }
     9  #B: {
    10  	[=~"^[m-z]*$"]: int
    11  }
    12  
    13  #C: #A & #B
    14  c:  #C & {aaa: 3}
    15  
    16  #D: {#A & #B}
    17  d: #D & {aaa: 3}
    18  -- out/def --
    19  #A: {
    20  	[=~"^[a-s]*$"]: int
    21  }
    22  #B: {
    23  	[=~"^[m-z]*$"]: int
    24  }
    25  #C: #A & #B
    26  c:  _|_ // field "aaa" not allowed in closed struct
    27  #D: {
    28  	#A & #B
    29  }
    30  d: _|_ // field "aaa" not allowed in closed struct
    31  -- out/legacy-debug --
    32  <0>{#A: <1>C{[=~"^[a-s]*$"]: <2>(_: string)->int, }, #B: <3>C{[=~"^[m-z]*$"]: <4>(_: string)->int, }, #C: <5>C{(C{[=~"^[a-s]*$"]: <6>(_: string)->int} & C{[=~"^[m-z]*$"]: <7>(_: string)->int}), }, c: _|_(3:field "aaa" not allowed in closed struct), #D: <8>C{(C{[=~"^[a-s]*$"]: <9>(_: string)->int} & C{[=~"^[m-z]*$"]: <10>(_: string)->int}), }, d: _|_(3:field "aaa" not allowed in closed struct)}
    33  -- out/compile --
    34  --- in.cue
    35  {
    36    #A: {
    37      [=~"^[a-s]*$"]: int
    38    }
    39    #B: {
    40      [=~"^[m-z]*$"]: int
    41    }
    42    #C: (〈0;#A〉 & 〈0;#B〉)
    43    c: (〈0;#C〉 & {
    44      aaa: 3
    45    })
    46    #D: {
    47      (〈1;#A〉 & 〈1;#B〉)
    48    }
    49    d: (〈0;#D〉 & {
    50      aaa: 3
    51    })
    52  }
    53  -- out/eval --
    54  Errors:
    55  c: field not allowed: aaa:
    56      ./in.cue:2:2
    57      ./in.cue:4:5
    58      ./in.cue:8:5
    59      ./in.cue:8:10
    60      ./in.cue:9:5
    61      ./in.cue:9:11
    62  d: field not allowed: aaa:
    63      ./in.cue:2:2
    64      ./in.cue:4:5
    65      ./in.cue:11:5
    66      ./in.cue:11:6
    67      ./in.cue:11:11
    68      ./in.cue:12:4
    69      ./in.cue:12:10
    70  
    71  Result:
    72  (_|_){
    73    // [eval]
    74    #A: (#struct){
    75    }
    76    #B: (#struct){
    77    }
    78    #C: (#struct){
    79    }
    80    c: (_|_){
    81      // [eval]
    82      aaa: (_|_){
    83        // [eval] c: field not allowed: aaa:
    84        //     ./in.cue:2:2
    85        //     ./in.cue:4:5
    86        //     ./in.cue:8:5
    87        //     ./in.cue:8:10
    88        //     ./in.cue:9:5
    89        //     ./in.cue:9:11
    90      }
    91    }
    92    #D: (#struct){
    93    }
    94    d: (_|_){
    95      // [eval]
    96      aaa: (_|_){
    97        // [eval] d: field not allowed: aaa:
    98        //     ./in.cue:2:2
    99        //     ./in.cue:4:5
   100        //     ./in.cue:11:5
   101        //     ./in.cue:11:6
   102        //     ./in.cue:11:11
   103        //     ./in.cue:12:4
   104        //     ./in.cue:12:10
   105      }
   106    }
   107  }