cuelang.org/go@v0.13.0/cue/testdata/eval/issue3905.txtar (about)

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