cuelang.org/go@v0.13.0/cue/testdata/disjunctions/nested.txtar (about)

     1  -- issue3635.cue --
     2  import "list"
     3  issue3635: case1: {
     4  	Run: {
     5  		env: *{[string]: string} | [...string]
     6  	}
     7  
     8  	command: Run & {
     9  		env: list.Concat([["foo"], ["bar"]])
    10  	}
    11  }
    12  
    13  issue3635: case2: {
    14  	out: [...#Schema]
    15  	out: [#Schema & {
    16  		name: "x"
    17  	}]
    18  
    19  	#Schema: {
    20  		name?: string
    21  		container?: [string]: string | #container
    22  
    23  		#container: string | {
    24  			env?: #env
    25  		}
    26  
    27  		#env: [string]: bool | string
    28  	}
    29  }
    30  
    31  issue3635: reduced: {
    32  	out: {X} & X
    33  	X: {
    34  		b: int | c
    35  		c: int | { e: d }
    36  	}
    37  	d: 1
    38  }
    39  
    40  issue3635: reduced_noshare: {
    41  	out: {X} & X
    42  	X: {
    43  		b: int | c
    44  		c: int | { e: d & __no_sharing }
    45  	}
    46  	d: 1
    47  }
    48  -- out/evalalpha/stats --
    49  Leaks:  111
    50  Freed:  0
    51  Reused: 0
    52  Allocs: 111
    53  Retain: 0
    54  
    55  Unifications: 63
    56  Conjuncts:    143
    57  Disjuncts:    44
    58  
    59  CloseIDElems: 10
    60  NumCloseIDs: 21
    61  -- diff/-out/evalalpha/stats<==>+out/eval/stats --
    62  diff old new
    63  --- old
    64  +++ new
    65  @@ -1,9 +1,12 @@
    66  -Leaks:  0
    67  -Freed:  159
    68  -Reused: 145
    69  -Allocs: 14
    70  -Retain: 62
    71  -
    72  -Unifications: 83
    73  -Conjuncts:    310
    74  -Disjuncts:    165
    75  +Leaks:  111
    76  +Freed:  0
    77  +Reused: 0
    78  +Allocs: 111
    79  +Retain: 0
    80  +
    81  +Unifications: 63
    82  +Conjuncts:    143
    83  +Disjuncts:    44
    84  +
    85  +CloseIDElems: 10
    86  +NumCloseIDs: 21
    87  -- out/eval/stats --
    88  Leaks:  0
    89  Freed:  159
    90  Reused: 145
    91  Allocs: 14
    92  Retain: 62
    93  
    94  Unifications: 83
    95  Conjuncts:    310
    96  Disjuncts:    165
    97  -- out/eval --
    98  (struct){
    99    issue3635: (struct){
   100      case1: (struct){
   101        Run: (struct){
   102          env: ((list|struct)){ |(*(struct){
   103            }, (list){
   104            }) }
   105        }
   106        command: (struct){
   107          env: (#list){
   108            0: (string){ "foo" }
   109            1: (string){ "bar" }
   110          }
   111        }
   112      }
   113      case2: (struct){
   114        out: (#list){
   115          0: (#struct){
   116            name: (string){ "x" }
   117            container?: (#struct){
   118            }
   119            #container: ((string|struct)){ |((string){ string }, (#struct){
   120                env?: (#struct){
   121                }
   122              }) }
   123            #env: (#struct){
   124            }
   125          }
   126        }
   127        #Schema: (#struct){
   128          name?: (string){ string }
   129          container?: (#struct){
   130          }
   131          #container: ((string|struct)){ |((string){ string }, (#struct){
   132              env?: (#struct){
   133              }
   134            }) }
   135          #env: (#struct){
   136          }
   137        }
   138      }
   139      reduced: (struct){
   140        out: (struct){
   141          b: ((int|struct)){ |((int){ int }, (struct){
   142              e: (int){ 1 }
   143            }) }
   144          c: ((int|struct)){ |((int){ int }, (struct){
   145              e: (int){ 1 }
   146            }) }
   147        }
   148        X: (struct){
   149          b: ((int|struct)){ |((int){ int }, (struct){
   150              e: (int){ 1 }
   151            }) }
   152          c: ((int|struct)){ |((int){ int }, (struct){
   153              e: (int){ 1 }
   154            }) }
   155        }
   156        d: (int){ 1 }
   157      }
   158      reduced_noshare: (struct){
   159        out: (struct){
   160          b: ((int|struct)){ |((int){ int }, (struct){
   161              e: (int){ 1 }
   162            }) }
   163          c: ((int|struct)){ |((int){ int }, (struct){
   164              e: (int){ 1 }
   165            }) }
   166        }
   167        X: (struct){
   168          b: ((int|struct)){ |((int){ int }, (struct){
   169              e: (int){ 1 }
   170            }) }
   171          c: ((int|struct)){ |((int){ int }, (struct){
   172              e: (int){ 1 }
   173            }) }
   174        }
   175        d: (int){ 1 }
   176      }
   177    }
   178  }
   179  -- out/compile --
   180  --- issue3635.cue
   181  {
   182    issue3635: {
   183      case1: {
   184        Run: {
   185          env: (*{
   186            [string]: string
   187          }|[
   188            ...string,
   189          ])
   190        }
   191        command: (〈0;Run〉 & {
   192          env: 〈import;list〉.Concat([
   193            [
   194              "foo",
   195            ],
   196            [
   197              "bar",
   198            ],
   199          ])
   200        })
   201      }
   202    }
   203    issue3635: {
   204      case2: {
   205        out: [
   206          ...〈1;#Schema〉,
   207        ]
   208        out: [
   209          (〈1;#Schema〉 & {
   210            name: "x"
   211          }),
   212        ]
   213        #Schema: {
   214          name?: string
   215          container?: {
   216            [string]: (string|〈1;#container〉)
   217          }
   218          #container: (string|{
   219            env?: 〈1;#env〉
   220          })
   221          #env: {
   222            [string]: (bool|string)
   223          }
   224        }
   225      }
   226    }
   227    issue3635: {
   228      reduced: {
   229        out: ({
   230          〈1;X〉
   231        } & 〈0;X〉)
   232        X: {
   233          b: (int|〈0;c〉)
   234          c: (int|{
   235            e: 〈2;d〉
   236          })
   237        }
   238        d: 1
   239      }
   240    }
   241    issue3635: {
   242      reduced_noshare: {
   243        out: ({
   244          〈1;X〉
   245        } & 〈0;X〉)
   246        X: {
   247          b: (int|〈0;c〉)
   248          c: (int|{
   249            e: (〈2;d〉 & _|_(no sharing))
   250          })
   251        }
   252        d: 1
   253      }
   254    }
   255  }