-- in.cue --
package x

somelist: [...string] | *[]
// Works just fine
foo: [
	for e in somelist {
		"hello foo: \(e)"
	},
]

otherlist: ["something"]
// Works fine as well
z: [
	for e in otherlist {
		"hello z: \(e)"
	},
]

extlist: [...string] | *["something"]
bar: [
	for e in extlist {
		"hello bar: \(e)"
	},
]
-- out/eval/stats --
Leaks:  0
Freed:  15
Reused: 10
Allocs: 5
Retain: 0

Unifications: 11
Conjuncts:    17
Disjuncts:    15
-- out/eval --
(struct){
  somelist: (list){ |(*(#list){
    }, (list){
    }) }
  foo: (#list){
  }
  otherlist: (#list){
    0: (string){ "something" }
  }
  z: (#list){
    0: (string){ "hello z: something" }
  }
  extlist: (list){ |(*(#list){
      0: (string){ "something" }
    }, (list){
    }) }
  bar: (#list){
    0: (string){ "hello bar: something" }
  }
}
-- out/compile --
--- in.cue
{
  somelist: ([
    ...string,
  ]|*[])
  foo: [
    for _, e in 〈1;somelist〉 {
      "hello foo: \(〈1;e〉)"
    },
  ]
  otherlist: [
    "something",
  ]
  z: [
    for _, e in 〈1;otherlist〉 {
      "hello z: \(〈1;e〉)"
    },
  ]
  extlist: ([
    ...string,
  ]|*[
    "something",
  ])
  bar: [
    for _, e in 〈1;extlist〉 {
      "hello bar: \(〈1;e〉)"
    },
  ]
}
