blob: 0e4876682b040264f38c8c41845dabe80d60b303 [file] [log] [blame]
-- in.cue --
import "regexp"
// Issue #655
// When evaluating a value into a struct, and then back into a value, the
// evaluation mode flips from Partial to AllArcs to Back. This is typically
// not an issue, but if a referred field is within a struct generated by a
// builtin, effectively the entire struct needs to be evaluated and special care
// should be taking to not evaluate too early.
builtinCyclePerm0: {
X: "example.com"
Y: {
#components: regexp.FindNamedSubmatch(#"^(?P<host>[[:alnum:].]+)$"#, X)
host: #components.host
}
X: Y.host
}
builtinCyclePerm1: {
X: Y.host
Y: {
#components: regexp.FindNamedSubmatch(#"^(?P<host>[[:alnum:].]+)$"#, X)
host: #components.host
}
X: "example.com"
}
builtinCyclePerm2: {
Y: {
#components: regexp.FindNamedSubmatch(#"^(?P<host>[[:alnum:].]+)$"#, X)
host: #components.host
}
X: Y.host
X: "example.com"
}
builtinCyclePerm3: {
Y: {
#components: regexp.FindNamedSubmatch(#"^(?P<host>[[:alnum:].]+)$"#, X)
host: #components.host
}
X: "example.com"
X: Y.host
}
builtinCyclePerm4: {
X: "example.com"
X: Y.host
Y: {
#components: regexp.FindNamedSubmatch(#"^(?P<host>[[:alnum:].]+)$"#, X)
host: #components.host
}
}
builtinCyclePerm5: {
X: Y.host
X: "example.com"
Y: {
#components: regexp.FindNamedSubmatch(#"^(?P<host>[[:alnum:].]+)$"#, X)
host: #components.host
}
}
-- out/eval --
(struct){
builtinCyclePerm0: (struct){
X: (string){ "example.com" }
Y: (struct){
#components: (#struct){
host: (string){ "example.com" }
}
host: (string){ "example.com" }
}
}
builtinCyclePerm1: (struct){
X: (string){ "example.com" }
Y: (struct){
#components: (#struct){
host: (string){ "example.com" }
}
host: (string){ "example.com" }
}
}
builtinCyclePerm2: (struct){
Y: (struct){
#components: (#struct){
host: (string){ "example.com" }
}
host: (string){ "example.com" }
}
X: (string){ "example.com" }
}
builtinCyclePerm3: (struct){
Y: (struct){
#components: (#struct){
host: (string){ "example.com" }
}
host: (string){ "example.com" }
}
X: (string){ "example.com" }
}
builtinCyclePerm4: (struct){
X: (string){ "example.com" }
Y: (struct){
#components: (#struct){
host: (string){ "example.com" }
}
host: (string){ "example.com" }
}
}
builtinCyclePerm5: (struct){
X: (string){ "example.com" }
Y: (struct){
#components: (#struct){
host: (string){ "example.com" }
}
host: (string){ "example.com" }
}
}
}
-- out/compile --
--- in.cue
{
builtinCyclePerm0: {
X: "example.com"
Y: {
#components: 〈import;regexp〉.FindNamedSubmatch("^(?P<host>[[:alnum:].]+)$", 〈1;X〉)
host: 0;#components〉.host
}
X: 0;Y〉.host
}
builtinCyclePerm1: {
X: 0;Y〉.host
Y: {
#components: 〈import;regexp〉.FindNamedSubmatch("^(?P<host>[[:alnum:].]+)$", 〈1;X〉)
host: 0;#components〉.host
}
X: "example.com"
}
builtinCyclePerm2: {
Y: {
#components: 〈import;regexp〉.FindNamedSubmatch("^(?P<host>[[:alnum:].]+)$", 〈1;X〉)
host: 0;#components〉.host
}
X: 0;Y〉.host
X: "example.com"
}
builtinCyclePerm3: {
Y: {
#components: 〈import;regexp〉.FindNamedSubmatch("^(?P<host>[[:alnum:].]+)$", 〈1;X〉)
host: 0;#components〉.host
}
X: "example.com"
X: 0;Y〉.host
}
builtinCyclePerm4: {
X: "example.com"
X: 0;Y〉.host
Y: {
#components: 〈import;regexp〉.FindNamedSubmatch("^(?P<host>[[:alnum:].]+)$", 〈1;X〉)
host: 0;#components〉.host
}
}
builtinCyclePerm5: {
X: 0;Y〉.host
X: "example.com"
Y: {
#components: 〈import;regexp〉.FindNamedSubmatch("^(?P<host>[[:alnum:].]+)$", 〈1;X〉)
host: 0;#components〉.host
}
}
}