|
| 1 | +-- in.cue -- |
| 2 | +import "encoding/yaml" |
| 3 | + |
| 4 | +issue3972: { |
| 5 | + // yaml uses Syntax to convert CUE to YAML. Ensure that unresolved values |
| 6 | + // are properly handled. |
| 7 | + output: out0: "static" // has to go first |
| 8 | + |
| 9 | + input: inputStatic: "static" |
| 10 | + if false { |
| 11 | + input: inputNever: "never" |
| 12 | + } |
| 13 | + |
| 14 | + derived: derivedStatic: "static" |
| 15 | + if false { |
| 16 | + derived: derivedNever: input.inputNever |
| 17 | + } |
| 18 | + |
| 19 | + _out1: [for svc, _ in derived {svc}] |
| 20 | + output: out1: yaml.Marshal(_out1) |
| 21 | + |
| 22 | +} |
| 23 | +-- out/eval/stats -- |
| 24 | +Leaks: 0 |
| 25 | +Freed: 10 |
| 26 | +Reused: 3 |
| 27 | +Allocs: 7 |
| 28 | +Retain: 2 |
| 29 | + |
| 30 | +Unifications: 10 |
| 31 | +Conjuncts: 12 |
| 32 | +Disjuncts: 12 |
| 33 | + |
| 34 | +CloseIDElems: 0 |
| 35 | +NumCloseIDs: 2 |
| 36 | +-- out/evalalpha -- |
| 37 | +Errors: |
| 38 | +issue3972.output.out1: error in call to encoding/yaml.Marshal: BUG: non-stringifiable *adt.scheduler: |
| 39 | + ./in.cue:19:16 |
| 40 | + |
| 41 | +Result: |
| 42 | +(_|_){ |
| 43 | + // [eval] |
| 44 | + issue3972: (_|_){ |
| 45 | + // [eval] |
| 46 | + output: (_|_){ |
| 47 | + // [eval] |
| 48 | + out0: (string){ "static" } |
| 49 | + out1: (_|_){ |
| 50 | + // [eval] issue3972.output.out1: error in call to encoding/yaml.Marshal: BUG: non-stringifiable *adt.scheduler: |
| 51 | + // ./in.cue:19:16 |
| 52 | + } |
| 53 | + } |
| 54 | + input: (struct){ |
| 55 | + inputStatic: (string){ "static" } |
| 56 | + } |
| 57 | + derived: (struct){ |
| 58 | + derivedStatic: (string){ "static" } |
| 59 | + } |
| 60 | + _out1: (#list){ |
| 61 | + 0: (string){ "derivedStatic" } |
| 62 | + } |
| 63 | + } |
| 64 | +} |
| 65 | +-- diff/-out/evalalpha<==>+out/eval -- |
| 66 | +diff old new |
| 67 | +--- old |
| 68 | ++++ new |
| 69 | +@@ -1,8 +1,19 @@ |
| 70 | +-(struct){ |
| 71 | +- issue3972: (struct){ |
| 72 | +- output: (struct){ |
| 73 | ++Errors: |
| 74 | ++issue3972.output.out1: error in call to encoding/yaml.Marshal: BUG: non-stringifiable *adt.scheduler: |
| 75 | ++ ./in.cue:19:16 |
| 76 | ++ |
| 77 | ++Result: |
| 78 | ++(_|_){ |
| 79 | ++ // [eval] |
| 80 | ++ issue3972: (_|_){ |
| 81 | ++ // [eval] |
| 82 | ++ output: (_|_){ |
| 83 | ++ // [eval] |
| 84 | + out0: (string){ "static" } |
| 85 | +- out1: (string){ "- derivedStatic\n" } |
| 86 | ++ out1: (_|_){ |
| 87 | ++ // [eval] issue3972.output.out1: error in call to encoding/yaml.Marshal: BUG: non-stringifiable *adt.scheduler: |
| 88 | ++ // ./in.cue:19:16 |
| 89 | ++ } |
| 90 | + } |
| 91 | + input: (struct){ |
| 92 | + inputStatic: (string){ "static" } |
| 93 | +-- out/eval -- |
| 94 | +(struct){ |
| 95 | + issue3972: (struct){ |
| 96 | + output: (struct){ |
| 97 | + out0: (string){ "static" } |
| 98 | + out1: (string){ "- derivedStatic\n" } |
| 99 | + } |
| 100 | + input: (struct){ |
| 101 | + inputStatic: (string){ "static" } |
| 102 | + } |
| 103 | + derived: (struct){ |
| 104 | + derivedStatic: (string){ "static" } |
| 105 | + } |
| 106 | + _out1: (#list){ |
| 107 | + 0: (string){ "derivedStatic" } |
| 108 | + } |
| 109 | + } |
| 110 | +} |
| 111 | +-- out/compile -- |
| 112 | +--- in.cue |
| 113 | +{ |
| 114 | + issue3972: { |
| 115 | + output: { |
| 116 | + out0: "static" |
| 117 | + } |
| 118 | + input: { |
| 119 | + inputStatic: "static" |
| 120 | + } |
| 121 | + if false { |
| 122 | + input: { |
| 123 | + inputNever: "never" |
| 124 | + } |
| 125 | + } |
| 126 | + derived: { |
| 127 | + derivedStatic: "static" |
| 128 | + } |
| 129 | + if false { |
| 130 | + derived: { |
| 131 | + derivedNever: 〈2;input〉.inputNever |
| 132 | + } |
| 133 | + } |
| 134 | + _out1: [ |
| 135 | + for svc, _ in 〈1;derived〉 { |
| 136 | + 〈1;svc〉 |
| 137 | + }, |
| 138 | + ] |
| 139 | + output: { |
| 140 | + out1: 〈import;"encoding/yaml"〉.Marshal(〈1;_out1〉) |
| 141 | + } |
| 142 | + } |
| 143 | +} |
0 commit comments