github.com/solo-io/cue@v0.4.7/cue/testdata/comprehensions/issue436.txtar (about) 1 -- in.cue -- 2 #a: { 3 val: string 4 result: string 5 } 6 7 a: #a & { 8 val: *"default" | string 9 result: *"not-matched" | string 10 if (val == "match") { 11 result: "matched" 12 } 13 } 14 15 match: a & { 16 val: "match" 17 } 18 19 not: a & { 20 val: "other" 21 } 22 -- out/eval -- 23 (struct){ 24 #a: (#struct){ 25 val: (string){ string } 26 result: (string){ string } 27 } 28 a: (#struct){ 29 val: (string){ |(*(string){ "default" }, (string){ string }) } 30 result: (string){ |(*(string){ "not-matched" }, (string){ string }) } 31 } 32 match: (#struct){ 33 val: (string){ "match" } 34 result: (string){ "matched" } 35 } 36 not: (#struct){ 37 val: (string){ "other" } 38 result: (string){ |(*(string){ "not-matched" }, (string){ string }) } 39 } 40 } 41 -- out/compile -- 42 --- in.cue 43 { 44 #a: { 45 val: string 46 result: string 47 } 48 a: (〈0;#a〉 & { 49 val: (*"default"|string) 50 result: (*"not-matched"|string) 51 if (〈0;val〉 == "match") { 52 result: "matched" 53 } 54 }) 55 match: (〈0;a〉 & { 56 val: "match" 57 }) 58 not: (〈0;a〉 & { 59 val: "other" 60 }) 61 }