cuelang.org/go@v0.10.1/cue/testdata/fulleval/049_alias_reuse_in_nested_scope.txtar (about)

     1  # DO NOT EDIT; generated by go run testdata/gen.go
     2  #
     3  #name: alias reuse in nested scope
     4  #evalFull
     5  -- in.cue --
     6  #Foo: {
     7  	let X = or([for k, _ in {} {k}])
     8  	connection: [X]: X
     9  }
    10  #A: {
    11  	foo: "key"
    12  	let X = foo
    13  	a: foo: [X]: X
    14  }
    15  #B: {
    16  	foo: string
    17  	let X = foo
    18  	a: foo: [X]: X
    19  }
    20  b: #B & {foo: "key"}
    21  -- out/def --
    22  #Foo: {
    23  	connection: {
    24  		[or([for k, _ in {
    25  				...
    26  		} { k }])]: or([for k, _ in {
    27  			...
    28  		} { k }])
    29  	}
    30  }
    31  #A: {
    32  	foo: "key"
    33  	a: {
    34  		foo: {
    35  			["key"]: "key"
    36  		}
    37  	}
    38  }
    39  #B: {
    40  	foo: string
    41  	FOO = foo
    42  	a: {
    43  		foo: {
    44  			[FOO]: FOO
    45  		}
    46  	}
    47  }
    48  b: #B & {
    49  	foo: "key"
    50  }
    51  -- out/export --
    52  b: {
    53  	foo: "key"
    54  	a: {
    55  		foo: {}
    56  	}
    57  }
    58  -- out/yaml --
    59  b:
    60    foo: key
    61    a:
    62      foo: {}
    63  -- out/json --
    64  {"b":{"foo":"key","a":{"foo":{}}}}
    65  -- out/legacy-debug --
    66  <0>{#Foo: <1>C{connection: <2>C{[or ([ <3>for k, _ in <4>{} yield <3>.k ])]: <5>(_: string)->or ([ <3>for k, _ in <4>{} yield <3>.k ]), }}, #A: <6>C{foo: "key", a: <7>C{foo: <8>C{["key"]: <9>(_: string)-><10>.foo, }}}, #B: <11>C{foo: string, a: <12>C{foo: <13>C{[string]: <14>(_: string)-><15>.foo, }}}, b: <16>C{foo: "key", a: <17>C{foo: <18>C{["key"]: <19>(_: string)-><20>.foo, }}}}
    67  -- out/eval/stats --
    68  Leaks:  10
    69  Freed:  19
    70  Reused: 15
    71  Allocs: 14
    72  Retain: 10
    73  
    74  Unifications: 29
    75  Conjuncts:    40
    76  Disjuncts:    29
    77  -- out/evalalpha --
    78  (struct){
    79    #Foo: (#struct){
    80      let X#1 = (_|_){
    81        // [incomplete] empty list in call to or:
    82        //     ./in.cue:2:10
    83      }
    84      connection: (_|_){
    85        // [incomplete] empty list in call to or:
    86        //     ./in.cue:2:10
    87      }
    88    }
    89    #A: (#struct){
    90      foo: (string){ "key" }
    91      let X#2 = (string){ "key" }
    92      a: (#struct){
    93        foo: (#struct){
    94        }
    95      }
    96    }
    97    #B: (#struct){
    98      foo: (string){ string }
    99      let X#3 = (string){ string }
   100      a: (#struct){
   101        foo: (#struct){
   102        }
   103      }
   104    }
   105    b: (#struct){
   106      foo: (string){ "key" }
   107      let X#3 = (string){ "key" }
   108      a: (#struct){
   109        foo: (#struct){
   110        }
   111      }
   112    }
   113  }
   114  -- diff/-out/evalalpha<==>+out/eval --
   115  diff old new
   116  --- old
   117  +++ new
   118  @@ -4,7 +4,9 @@
   119         // [incomplete] empty list in call to or:
   120         //     ./in.cue:2:10
   121       }
   122  -    connection: (#struct){
   123  +    connection: (_|_){
   124  +      // [incomplete] empty list in call to or:
   125  +      //     ./in.cue:2:10
   126       }
   127     }
   128     #A: (#struct){
   129  -- diff/explanation --
   130  The new error is a correct error, as the pattern constraint is invalid.
   131  Seems reasonable to report error at connection as well.
   132  -- out/eval --
   133  (struct){
   134    #Foo: (#struct){
   135      let X#1 = (_|_){
   136        // [incomplete] empty list in call to or:
   137        //     ./in.cue:2:10
   138      }
   139      connection: (#struct){
   140      }
   141    }
   142    #A: (#struct){
   143      foo: (string){ "key" }
   144      let X#2 = (string){ "key" }
   145      a: (#struct){
   146        foo: (#struct){
   147        }
   148      }
   149    }
   150    #B: (#struct){
   151      foo: (string){ string }
   152      let X#3 = (string){ string }
   153      a: (#struct){
   154        foo: (#struct){
   155        }
   156      }
   157    }
   158    b: (#struct){
   159      foo: (string){ "key" }
   160      let X#3 = (string){ "key" }
   161      a: (#struct){
   162        foo: (#struct){
   163        }
   164      }
   165    }
   166  }
   167  -- out/compile --
   168  --- in.cue
   169  {
   170    #Foo: {
   171      let X#1 = or([
   172        for k, _ in {} {
   173          〈1;k〉
   174        },
   175      ])
   176      connection: {
   177        [〈1;let X#1〉]: 〈1;let X#1〉
   178      }
   179    }
   180    #A: {
   181      foo: "key"
   182      let X#2 = 〈0;foo〉
   183      a: {
   184        foo: {
   185          [〈2;let X#2〉]: 〈2;let X#2〉
   186        }
   187      }
   188    }
   189    #B: {
   190      foo: string
   191      let X#3 = 〈0;foo〉
   192      a: {
   193        foo: {
   194          [〈2;let X#3〉]: 〈2;let X#3〉
   195        }
   196      }
   197    }
   198    b: (〈0;#B〉 & {
   199      foo: "key"
   200    })
   201  }