this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

internal/core/adt: add tests for let

These are used to ensure non-changing semantics
when moving to the new let ref implemenation.

Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com>
Change-Id: Ia9342631bcb06c6b4a14e437268533248fa0fb14
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/543360
Reviewed-by: Roger Peppe <rogpeppe@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUEcueckoo <cueckoo@cuelang.org>

+147
+147
cue/testdata/eval/letjoin.txtar
··· 1 + -- in.cue -- 2 + // Test that an error in a let that is merged with itself from two different 3 + // origins does not result in an error as long as the error is not referenced 4 + // outside the let. 5 + t1: { 6 + x: { 7 + a: int 8 + y: { 9 + let X = { 10 + b: a 11 + c: 1 12 + } 13 + v: X.c 14 + } 15 + } 16 + 17 + x1: x 18 + x1: a: 1 19 + 20 + x2: x 21 + x2: a: 2 22 + 23 + xy: x1.y & x2.y 24 + } 25 + 26 + t2: { 27 + x: { 28 + a: {} 29 + y: { 30 + let X = { 31 + b: a 32 + c: 1 33 + } 34 + v: X.c 35 + } 36 + } 37 + 38 + x1: x 39 + x1: a: q: 1 40 + 41 + x2: x 42 + x2: a: r: 2 43 + 44 + xy: x1 & x2 45 + } 46 + -- out/eval -- 47 + (struct){ 48 + t1: (struct){ 49 + x: (struct){ 50 + a: (int){ int } 51 + y: (struct){ 52 + v: (int){ 1 } 53 + } 54 + } 55 + x1: (struct){ 56 + a: (int){ 1 } 57 + y: (struct){ 58 + v: (int){ 1 } 59 + } 60 + } 61 + x2: (struct){ 62 + a: (int){ 2 } 63 + y: (struct){ 64 + v: (int){ 1 } 65 + } 66 + } 67 + xy: (struct){ 68 + v: (int){ 1 } 69 + } 70 + } 71 + t2: (struct){ 72 + x: (struct){ 73 + a: (struct){ 74 + } 75 + y: (struct){ 76 + v: (int){ 1 } 77 + } 78 + } 79 + x1: (struct){ 80 + a: (struct){ 81 + q: (int){ 1 } 82 + } 83 + y: (struct){ 84 + v: (int){ 1 } 85 + } 86 + } 87 + x2: (struct){ 88 + a: (struct){ 89 + r: (int){ 2 } 90 + } 91 + y: (struct){ 92 + v: (int){ 1 } 93 + } 94 + } 95 + xy: (struct){ 96 + a: (struct){ 97 + q: (int){ 1 } 98 + r: (int){ 2 } 99 + } 100 + y: (struct){ 101 + v: (int){ 1 } 102 + } 103 + } 104 + } 105 + } 106 + -- out/compile -- 107 + --- in.cue 108 + { 109 + t1: { 110 + x: { 111 + a: int 112 + y: { 113 + v: 〈0;let X〉.c 114 + } 115 + } 116 + x1: 〈0;x〉 117 + x1: { 118 + a: 1 119 + } 120 + x2: 〈0;x〉 121 + x2: { 122 + a: 2 123 + } 124 + xy: (〈0;x1〉.y & 〈0;x2〉.y) 125 + } 126 + t2: { 127 + x: { 128 + a: {} 129 + y: { 130 + v: 〈0;let X〉.c 131 + } 132 + } 133 + x1: 〈0;x〉 134 + x1: { 135 + a: { 136 + q: 1 137 + } 138 + } 139 + x2: 〈0;x〉 140 + x2: { 141 + a: { 142 + r: 2 143 + } 144 + } 145 + xy: (〈0;x1〉 & 〈0;x2〉) 146 + } 147 + }