1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
|
-- in.cue --
X: {
#Simple: {
ref: string
}
#Complex: {
{
ref: string
} | {
local: string
}
}
var: "XXX"
// Validate(concrete) after Fill() on Complex.ref from a "static" key will succeed
"test_1": #Complex
// Validate(concrete) after Fill() on "#Simple.ref" from a "dynamic" key will succeed
"test_2_\(var)": #Simple
// Validate(concrete) after Fill() on Complex.ref from a "dynamic" key will fail
"test_3_\(var)": #Complex
test_3_XXX: ref: "FOO"
}
Z: X.test_3_XXX.ref
-- out/eval/stats --
Leaks: 0
Freed: 24
Reused: 17
Allocs: 7
Retain: 2
Unifications: 18
Conjuncts: 33
Disjuncts: 24
-- out/evalalpha --
(struct){
X: (struct){
#Simple: (#struct){
ref: (string){ string }
}
#Complex: (#struct){ |((#struct){
ref: (string){ string }
}, (#struct){
local: (string){ string }
}) }
var: (string){ "XXX" }
test_1: (#struct){ |((#struct){
ref: (string){ string }
}, (#struct){
local: (string){ string }
}) }
test_3_XXX: (#struct){
ref: (string){ "FOO" }
}
test_2_XXX: ~(X.#Simple)
}
Z: (string){ "FOO" }
}
-- diff/-out/evalalpha<==>+out/eval --
diff old new
--- old
+++ new
@@ -17,9 +17,7 @@
test_3_XXX: (#struct){
ref: (string){ "FOO" }
}
- test_2_XXX: (#struct){
- ref: (string){ string }
- }
+ test_2_XXX: ~(X.#Simple)
}
Z: (string){ "FOO" }
}
-- out/eval --
(struct){
X: (struct){
#Simple: (#struct){
ref: (string){ string }
}
#Complex: (#struct){ |((#struct){
ref: (string){ string }
}, (#struct){
local: (string){ string }
}) }
var: (string){ "XXX" }
test_1: (#struct){ |((#struct){
ref: (string){ string }
}, (#struct){
local: (string){ string }
}) }
test_3_XXX: (#struct){
ref: (string){ "FOO" }
}
test_2_XXX: (#struct){
ref: (string){ string }
}
}
Z: (string){ "FOO" }
}
-- out/compile --
--- in.cue
{
X: {
#Simple: {
ref: string
}
#Complex: {
({
ref: string
}|{
local: string
})
}
var: "XXX"
test_1: 〈0;#Complex〉
"test_2_\(〈0;var〉)": 〈0;#Simple〉
"test_3_\(〈0;var〉)": 〈0;#Complex〉
test_3_XXX: {
ref: "FOO"
}
}
Z: 〈0;X〉.test_3_XXX.ref
}
|