cuelang.org/go@v0.13.0/cue/testdata/eval/dynamic_field.txtar (about)

     1  -- in.cue --
     2  a: "foo"
     3  "\(a)": b: c: d: e
     4  e: 2
     5  
     6  b: "bar"
     7  X="\(b)": {
     8  	a: 1
     9  }
    10  c: X
    11  
    12  withError: {
    13  	issue799: {key: int32} & {"\(1 & 2)": 123}
    14  }
    15  
    16  parenExprRefParent: {
    17  	a: (x): {}
    18  	x: "foo"
    19  }
    20  parenExprRefEqual: {
    21  	(x): {}
    22  	x: "foo"
    23  }
    24  chainedResolution: {
    25  	p1: {
    26  		(p1.baz): "bar"
    27  		(p1.foo): "baz"
    28  		baz: "foo"
    29  	}
    30  	p2: {
    31  		(p2.baz): "bar"
    32  		baz: "foo"
    33  		(p2.foo): "baz"
    34  	}
    35  	p3: {
    36  		baz: "foo"
    37  		(p3.baz): "bar"
    38  		(p3.foo): "baz"
    39  	}
    40  	p4: {
    41  		(p4.foo): "baz"
    42  		(p4.baz): "bar"
    43  		baz: "foo"
    44  	}
    45  	p5: {
    46  		(p5.foo): "baz"
    47  		baz: "foo"
    48  		(p5.baz): "bar"
    49  	}
    50  	p6: {
    51  		baz: "foo"
    52  		(p6.foo): "baz"
    53  		(p6.baz): "bar"
    54  	}
    55  }
    56  
    57  // Issue #1407
    58  noCycleError: {
    59  	foo: [_]: {
    60  		#ID: "\(string)"
    61  	}
    62  	foo: bar: entries: (foo.baz.#ID): true
    63  	foo: baz: {}
    64  }
    65  
    66  -- constraints.cue --
    67  constraints: {
    68  	t1: "foo"
    69  	t2: "bar"
    70  	(t1)?: (t2)!: 3
    71  }
    72  -- issue3828.cue --
    73  issue3828: reduced: {
    74  	a: b: {}
    75  	a: [_]: {
    76  		if true let x=str {
    77  			(x): true
    78  		}
    79  	}
    80  	str: "foobot1"
    81  }
    82  issue3828: full: {
    83  	orgs: org1: {
    84  		repos: repo1: {}
    85  	}
    86  	botUser: "bot1"
    87  	orgs: [_]: config={
    88  		for repo_name, _ in config.repos
    89  		let orgBotUser = botUser {
    90  			collaborators: (repo_name): (orgBotUser): true
    91  		}
    92  	}
    93  }
    94  -- out/eval/stats --
    95  Leaks:  4
    96  Freed:  76
    97  Reused: 67
    98  Allocs: 13
    99  Retain: 17
   100  
   101  Unifications: 80
   102  Conjuncts:    101
   103  Disjuncts:    87
   104  -- out/evalalpha --
   105  Errors:
   106  invalid interpolation: conflicting values 2 and 1:
   107      ./in.cue:12:28
   108      ./in.cue:12:31
   109      ./in.cue:12:35
   110  
   111  Result:
   112  (_|_){
   113    // [eval]
   114    constraints: (struct){
   115      t1: (string){ "foo" }
   116      t2: (string){ "bar" }
   117      foo?: (struct){
   118        bar!: (int){ 3 }
   119      }
   120    }
   121    a: (string){ "foo" }
   122    e: (int){ 2 }
   123    b: (string){ "bar" }
   124    c: ~(bar)
   125    withError: (_|_){
   126      // [eval]
   127      issue799: (_|_){
   128        // [eval] invalid interpolation: conflicting values 2 and 1:
   129        //     ./in.cue:12:28
   130        //     ./in.cue:12:31
   131        //     ./in.cue:12:35
   132        key: (int){ &(>=-2147483648, <=2147483647, int) }
   133      }
   134    }
   135    parenExprRefParent: (struct){
   136      a: (struct){
   137        foo: (struct){
   138        }
   139      }
   140      x: (string){ "foo" }
   141    }
   142    parenExprRefEqual: (struct){
   143      x: (string){ "foo" }
   144      foo: (struct){
   145      }
   146    }
   147    chainedResolution: (struct){
   148      p1: (struct){
   149        baz: (string){ "foo" }
   150        foo: (string){ "bar" }
   151        bar: (string){ "baz" }
   152      }
   153      p2: (struct){
   154        baz: (string){ "foo" }
   155        foo: (string){ "bar" }
   156        bar: (string){ "baz" }
   157      }
   158      p3: (struct){
   159        baz: (string){ "foo" }
   160        foo: (string){ "bar" }
   161        bar: (string){ "baz" }
   162      }
   163      p4: (struct){
   164        baz: (string){ "foo" }
   165        foo: (string){ "bar" }
   166        bar: (string){ "baz" }
   167      }
   168      p5: (struct){
   169        baz: (string){ "foo" }
   170        foo: (string){ "bar" }
   171        bar: (string){ "baz" }
   172      }
   173      p6: (struct){
   174        baz: (string){ "foo" }
   175        foo: (string){ "bar" }
   176        bar: (string){ "baz" }
   177      }
   178    }
   179    noCycleError: (struct){
   180      foo: (struct){
   181        bar: (struct){
   182          entries: (_|_){
   183            // [incomplete] noCycleError.foo.baz.#ID: invalid interpolation: non-concrete value string (type string):
   184            //     ./in.cue:59:8
   185            //     ./in.cue:59:11
   186            // noCycleError.foo.bar.entries: key value of dynamic field must be concrete, found _|_(invalid interpolation: noCycleError.foo.baz.#ID: non-concrete value string (type string)):
   187            //     ./in.cue:61:22
   188          }
   189          #ID: (_|_){
   190            // [incomplete] noCycleError.foo.bar.#ID: invalid interpolation: non-concrete value string (type string):
   191            //     ./in.cue:59:8
   192            //     ./in.cue:59:11
   193          }
   194        }
   195        baz: (struct){
   196          #ID: (_|_){
   197            // [incomplete] noCycleError.foo.baz.#ID: invalid interpolation: non-concrete value string (type string):
   198            //     ./in.cue:59:8
   199            //     ./in.cue:59:11
   200          }
   201        }
   202      }
   203    }
   204    issue3828: (struct){
   205      reduced: (struct){
   206        a: (struct){
   207          b: (struct){
   208            foobot1: (bool){ true }
   209          }
   210        }
   211        str: (string){ "foobot1" }
   212      }
   213      full: (struct){
   214        orgs: (struct){
   215          org1: (struct){
   216            repos: (struct){
   217              repo1: (struct){
   218              }
   219            }
   220            collaborators: (struct){
   221              repo1: (struct){
   222                bot1: (bool){ true }
   223              }
   224            }
   225          }
   226        }
   227        botUser: (string){ "bot1" }
   228      }
   229    }
   230    bar: (struct){
   231      a: (int){ 1 }
   232    }
   233    foo: (struct){
   234      b: (struct){
   235        c: (struct){
   236          d: (int){ 2 }
   237        }
   238      }
   239    }
   240  }
   241  -- diff/-out/evalalpha<==>+out/eval --
   242  diff old new
   243  --- old
   244  +++ new
   245  @@ -17,9 +17,7 @@
   246     a: (string){ "foo" }
   247     e: (int){ 2 }
   248     b: (string){ "bar" }
   249  -  c: (struct){
   250  -    a: (int){ 1 }
   251  -  }
   252  +  c: ~(bar)
   253     withError: (_|_){
   254       // [eval]
   255       issue799: (_|_){
   256  @@ -81,6 +79,8 @@
   257             // [incomplete] noCycleError.foo.baz.#ID: invalid interpolation: non-concrete value string (type string):
   258             //     ./in.cue:59:8
   259             //     ./in.cue:59:11
   260  +          // noCycleError.foo.bar.entries: key value of dynamic field must be concrete, found _|_(invalid interpolation: noCycleError.foo.baz.#ID: non-concrete value string (type string)):
   261  +          //     ./in.cue:61:22
   262           }
   263           #ID: (_|_){
   264             // [incomplete] noCycleError.foo.bar.#ID: invalid interpolation: non-concrete value string (type string):
   265  @@ -123,6 +123,9 @@
   266         botUser: (string){ "bot1" }
   267       }
   268     }
   269  +  bar: (struct){
   270  +    a: (int){ 1 }
   271  +  }
   272     foo: (struct){
   273       b: (struct){
   274         c: (struct){
   275  @@ -130,7 +133,4 @@
   276         }
   277       }
   278     }
   279  -  bar: (struct){
   280  -    a: (int){ 1 }
   281  -  }
   282   }
   283  -- diff/todo/p2 --
   284  Added near-duplicate message
   285  -- out/eval --
   286  Errors:
   287  invalid interpolation: conflicting values 2 and 1:
   288      ./in.cue:12:28
   289      ./in.cue:12:31
   290      ./in.cue:12:35
   291  
   292  Result:
   293  (_|_){
   294    // [eval]
   295    constraints: (struct){
   296      t1: (string){ "foo" }
   297      t2: (string){ "bar" }
   298      foo?: (struct){
   299        bar!: (int){ 3 }
   300      }
   301    }
   302    a: (string){ "foo" }
   303    e: (int){ 2 }
   304    b: (string){ "bar" }
   305    c: (struct){
   306      a: (int){ 1 }
   307    }
   308    withError: (_|_){
   309      // [eval]
   310      issue799: (_|_){
   311        // [eval] invalid interpolation: conflicting values 2 and 1:
   312        //     ./in.cue:12:28
   313        //     ./in.cue:12:31
   314        //     ./in.cue:12:35
   315        key: (int){ &(>=-2147483648, <=2147483647, int) }
   316      }
   317    }
   318    parenExprRefParent: (struct){
   319      a: (struct){
   320        foo: (struct){
   321        }
   322      }
   323      x: (string){ "foo" }
   324    }
   325    parenExprRefEqual: (struct){
   326      x: (string){ "foo" }
   327      foo: (struct){
   328      }
   329    }
   330    chainedResolution: (struct){
   331      p1: (struct){
   332        baz: (string){ "foo" }
   333        foo: (string){ "bar" }
   334        bar: (string){ "baz" }
   335      }
   336      p2: (struct){
   337        baz: (string){ "foo" }
   338        foo: (string){ "bar" }
   339        bar: (string){ "baz" }
   340      }
   341      p3: (struct){
   342        baz: (string){ "foo" }
   343        foo: (string){ "bar" }
   344        bar: (string){ "baz" }
   345      }
   346      p4: (struct){
   347        baz: (string){ "foo" }
   348        foo: (string){ "bar" }
   349        bar: (string){ "baz" }
   350      }
   351      p5: (struct){
   352        baz: (string){ "foo" }
   353        foo: (string){ "bar" }
   354        bar: (string){ "baz" }
   355      }
   356      p6: (struct){
   357        baz: (string){ "foo" }
   358        foo: (string){ "bar" }
   359        bar: (string){ "baz" }
   360      }
   361    }
   362    noCycleError: (struct){
   363      foo: (struct){
   364        bar: (struct){
   365          entries: (_|_){
   366            // [incomplete] noCycleError.foo.baz.#ID: invalid interpolation: non-concrete value string (type string):
   367            //     ./in.cue:59:8
   368            //     ./in.cue:59:11
   369          }
   370          #ID: (_|_){
   371            // [incomplete] noCycleError.foo.bar.#ID: invalid interpolation: non-concrete value string (type string):
   372            //     ./in.cue:59:8
   373            //     ./in.cue:59:11
   374          }
   375        }
   376        baz: (struct){
   377          #ID: (_|_){
   378            // [incomplete] noCycleError.foo.baz.#ID: invalid interpolation: non-concrete value string (type string):
   379            //     ./in.cue:59:8
   380            //     ./in.cue:59:11
   381          }
   382        }
   383      }
   384    }
   385    issue3828: (struct){
   386      reduced: (struct){
   387        a: (struct){
   388          b: (struct){
   389            foobot1: (bool){ true }
   390          }
   391        }
   392        str: (string){ "foobot1" }
   393      }
   394      full: (struct){
   395        orgs: (struct){
   396          org1: (struct){
   397            repos: (struct){
   398              repo1: (struct){
   399              }
   400            }
   401            collaborators: (struct){
   402              repo1: (struct){
   403                bot1: (bool){ true }
   404              }
   405            }
   406          }
   407        }
   408        botUser: (string){ "bot1" }
   409      }
   410    }
   411    foo: (struct){
   412      b: (struct){
   413        c: (struct){
   414          d: (int){ 2 }
   415        }
   416      }
   417    }
   418    bar: (struct){
   419      a: (int){ 1 }
   420    }
   421  }
   422  -- out/compile --
   423  --- constraints.cue
   424  {
   425    constraints: {
   426      t1: "foo"
   427      t2: "bar"
   428      〈0;t1〉?: {
   429        〈1;t2〉!: 3
   430      }
   431    }
   432  }
   433  --- in.cue
   434  {
   435    a: "foo"
   436    "\(〈0;a〉)": {
   437      b: {
   438        c: {
   439          d: 〈3;e〉
   440        }
   441      }
   442    }
   443    e: 2
   444    b: "bar"
   445    "\(〈0;b〉)": {
   446      a: 1
   447    }
   448    c: 〈0;("\(〈0;b〉)")〉
   449    withError: {
   450      issue799: ({
   451        key: &(int, >=-2147483648, <=2147483647)
   452      } & {
   453        "\((1 & 2))": 123
   454      })
   455    }
   456    parenExprRefParent: {
   457      a: {
   458        〈1;x〉: {}
   459      }
   460      x: "foo"
   461    }
   462    parenExprRefEqual: {
   463      〈0;x〉: {}
   464      x: "foo"
   465    }
   466    chainedResolution: {
   467      p1: {
   468        〈1;p1〉.baz: "bar"
   469        〈1;p1〉.foo: "baz"
   470        baz: "foo"
   471      }
   472      p2: {
   473        〈1;p2〉.baz: "bar"
   474        baz: "foo"
   475        〈1;p2〉.foo: "baz"
   476      }
   477      p3: {
   478        baz: "foo"
   479        〈1;p3〉.baz: "bar"
   480        〈1;p3〉.foo: "baz"
   481      }
   482      p4: {
   483        〈1;p4〉.foo: "baz"
   484        〈1;p4〉.baz: "bar"
   485        baz: "foo"
   486      }
   487      p5: {
   488        〈1;p5〉.foo: "baz"
   489        baz: "foo"
   490        〈1;p5〉.baz: "bar"
   491      }
   492      p6: {
   493        baz: "foo"
   494        〈1;p6〉.foo: "baz"
   495        〈1;p6〉.baz: "bar"
   496      }
   497    }
   498    noCycleError: {
   499      foo: {
   500        [_]: {
   501          #ID: "\(string)"
   502        }
   503      }
   504      foo: {
   505        bar: {
   506          entries: {
   507            〈3;foo〉.baz.#ID: true
   508          }
   509        }
   510      }
   511      foo: {
   512        baz: {}
   513      }
   514    }
   515  }
   516  --- issue3828.cue
   517  {
   518    issue3828: {
   519      reduced: {
   520        a: {
   521          b: {}
   522        }
   523        a: {
   524          [_]: {
   525            if true let x = 〈2;str〉 {
   526              〈1;x〉: true
   527            }
   528          }
   529        }
   530        str: "foobot1"
   531      }
   532    }
   533    issue3828: {
   534      full: {
   535        orgs: {
   536          org1: {
   537            repos: {
   538              repo1: {}
   539            }
   540          }
   541        }
   542        botUser: "bot1"
   543        orgs: {
   544          [_]: {
   545            for repo_name, _ in 〈1〉.repos let orgBotUser = 〈3;botUser〉 {
   546              collaborators: {
   547                〈3;repo_name〉: {
   548                  〈3;orgBotUser〉: true
   549                }
   550              }
   551            }
   552          }
   553        }
   554      }
   555    }
   556  }