internal/core/eval: verify issue 258 is fixed
Fixes #285
Change-Id: I5059c435fa88eb8130927809703d7ebaaeed280e
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/6943
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/cue/testdata/eval/issue285.txtar b/cue/testdata/eval/issue285.txtar
new file mode 100644
index 0000000..6abbe4a
--- /dev/null
+++ b/cue/testdata/eval/issue285.txtar
@@ -0,0 +1,48 @@
+-- in.cue --
+#TopLevel: [name=string]: {
+ path: string
+ content: string
+}
+
+#Mid: #TopLevel & {
+ myoutput: path: "/output"
+}
+
+val: #Mid & {} & {myoutput: {content: "foo"}} // Should work.
+-- out/eval --
+(struct){
+ #TopLevel: (#struct){
+ }
+ #Mid: (#struct){
+ myoutput: (#struct){
+ path: (string){ "/output" }
+ content: (string){ string }
+ }
+ }
+ val: (#struct){
+ myoutput: (#struct){
+ path: (string){ "/output" }
+ content: (string){ "foo" }
+ }
+ }
+}
+-- out/compile --
+--- in.cue
+{
+ #TopLevel: {
+ [string]: {
+ path: string
+ content: string
+ }
+ }
+ #Mid: (〈0;#TopLevel〉 & {
+ myoutput: {
+ path: "/output"
+ }
+ })
+ val: ((〈0;#Mid〉 & {}) & {
+ myoutput: {
+ content: "foo"
+ }
+ })
+}