internal/core/eval: verify issue 332 is fixed
Fixes #332
Change-Id: Id4b479cf6b0457124d2ea837bc0a879a2f598729
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/6945
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/cue/testdata/builtins/list/issue332.txtar b/cue/testdata/builtins/list/issue332.txtar
new file mode 100644
index 0000000..ab2cdd6
--- /dev/null
+++ b/cue/testdata/builtins/list/issue332.txtar
@@ -0,0 +1,53 @@
+-- in.cue --
+import "list"
+#d: {
+ #x: string
+ result: [#x]
+}
+#foo: {
+ X=#x: _
+ y: list.FlattenN((#d & {#x: X}).result, 1)
+}
+r: #foo & {
+ #x: "hello"
+}
+-- out/eval --
+(struct){
+ #d: (#struct){
+ #x: (string){ string }
+ result: (#list){
+ 0: (string){ string }
+ }
+ }
+ #foo: (#struct){
+ #x: (_){ _ }
+ y: (#list){
+ 0: (string){ string }
+ }
+ }
+ r: (#struct){
+ #x: (string){ "hello" }
+ y: (#list){
+ 0: (string){ "hello" }
+ }
+ }
+}
+-- out/compile --
+--- in.cue
+{
+ #d: {
+ #x: string
+ result: [
+ 〈0;#x〉,
+ ]
+ }
+ #foo: {
+ #x: _
+ y: 〈import;list〉.FlattenN((〈1;#d〉 & {
+ #x: 〈1;#x〉
+ }).result, 1)
+ }
+ r: (〈0;#foo〉 & {
+ #x: "hello"
+ })
+}