...

Text file src/cuelang.org/go/cue/testdata/eval/dynamic_field.txtar

Documentation: cuelang.org/go/cue/testdata/eval

     1-- in.cue --
     2a: "foo"
     3"\(a)": b: c: d: e
     4e: 2
     5
     6b: "bar"
     7X="\(b)": {
     8	a: 1
     9}
    10c: X
    11
    12withError: {
    13	issue799: {key: int32} & {"\(1 & 2)": 123}
    14}
    15
    16parenExprRefParent: {
    17	a: (x): {}
    18	x: "foo"
    19}
    20parenExprRefEqual: {
    21	(x): {}
    22	x: "foo"
    23}
    24chainedResolution: {
    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
    58noCycleError: {
    59	foo: [_]: {
    60		#ID: "\(string)"
    61	}
    62	foo: bar: entries: (foo.baz.#ID): true
    63	foo: baz: {}
    64}
    65
    66-- constraints.cue --
    67constraints: {
    68	t1: "foo"
    69	t2: "bar"
    70	(t1)?: (t2)!: 3
    71}
    72
    73-- out/eval/stats --
    74Leaks:  2
    75Freed:  59
    76Reused: 52
    77Allocs: 9
    78Retain: 11
    79
    80Unifications: 61
    81Conjuncts:    77
    82Disjuncts:    66
    83-- out/evalalpha --
    84Errors:
    85invalid interpolation: conflicting values 2 and 1:
    86    ./in.cue:12:28
    87    ./in.cue:12:31
    88    ./in.cue:12:35
    89
    90Result:
    91(_|_){
    92  // [eval]
    93  constraints: (struct){
    94    t1: (string){ "foo" }
    95    t2: (string){ "bar" }
    96    foo?: (struct){
    97      bar!: (int){ 3 }
    98    }
    99  }
   100  a: (string){ "foo" }
   101  e: (int){ 2 }
   102  b: (string){ "bar" }
   103  c: (struct){
   104    a: (int){ 1 }
   105  }
   106  withError: (_|_){
   107    // [eval]
   108    issue799: (_|_){
   109      // [eval] invalid interpolation: conflicting values 2 and 1:
   110      //     ./in.cue:12:28
   111      //     ./in.cue:12:31
   112      //     ./in.cue:12:35
   113      key: (int){ &(>=-2147483648, <=2147483647, int) }
   114    }
   115  }
   116  parenExprRefParent: (struct){
   117    a: (struct){
   118      foo: (struct){
   119      }
   120    }
   121    x: (string){ "foo" }
   122  }
   123  parenExprRefEqual: (struct){
   124    x: (string){ "foo" }
   125    foo: (struct){
   126    }
   127  }
   128  chainedResolution: (struct){
   129    p1: (struct){
   130      baz: (string){ "foo" }
   131      foo: (string){ "bar" }
   132      bar: (string){ "baz" }
   133    }
   134    p2: (struct){
   135      baz: (string){ "foo" }
   136      foo: (string){ "bar" }
   137      bar: (string){ "baz" }
   138    }
   139    p3: (struct){
   140      baz: (string){ "foo" }
   141      foo: (string){ "bar" }
   142      bar: (string){ "baz" }
   143    }
   144    p4: (struct){
   145      baz: (string){ "foo" }
   146      foo: (string){ "bar" }
   147      bar: (string){ "baz" }
   148    }
   149    p5: (struct){
   150      baz: (string){ "foo" }
   151      foo: (string){ "bar" }
   152      bar: (string){ "baz" }
   153    }
   154    p6: (struct){
   155      baz: (string){ "foo" }
   156      foo: (string){ "bar" }
   157      bar: (string){ "baz" }
   158    }
   159  }
   160  noCycleError: (struct){
   161    foo: (struct){
   162      bar: (struct){
   163        entries: (_|_){
   164          // [incomplete] noCycleError.foo.baz.#ID: invalid interpolation: non-concrete value string (type string):
   165          //     ./in.cue:59:8
   166          //     ./in.cue:59:11
   167          // 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) (and 1 more errors)):
   168          //     ./in.cue:61:22
   169        }
   170        #ID: (_|_){
   171          // [incomplete] noCycleError.foo.bar.#ID: invalid interpolation: non-concrete value string (type string):
   172          //     ./in.cue:59:8
   173          //     ./in.cue:59:11
   174        }
   175      }
   176      baz: (struct){
   177        #ID: (_|_){
   178          // [incomplete] noCycleError.foo.baz.#ID: invalid interpolation: non-concrete value string (type string):
   179          //     ./in.cue:59:8
   180          //     ./in.cue:59:11
   181        }
   182      }
   183    }
   184  }
   185  bar: (struct){
   186    a: (int){ 1 }
   187  }
   188  foo: (struct){
   189    b: (struct){
   190      c: (struct){
   191        d: (int){ 2 }
   192      }
   193    }
   194  }
   195}
   196-- diff/-out/evalalpha<==>+out/eval --
   197diff old new
   198--- old
   199+++ new
   200@@ -81,6 +81,8 @@
   201           // [incomplete] noCycleError.foo.baz.#ID: invalid interpolation: non-concrete value string (type string):
   202           //     ./in.cue:59:8
   203           //     ./in.cue:59:11
   204+          // 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) (and 1 more errors)):
   205+          //     ./in.cue:61:22
   206         }
   207         #ID: (_|_){
   208           // [incomplete] noCycleError.foo.bar.#ID: invalid interpolation: non-concrete value string (type string):
   209@@ -97,6 +99,9 @@
   210       }
   211     }
   212   }
   213+  bar: (struct){
   214+    a: (int){ 1 }
   215+  }
   216   foo: (struct){
   217     b: (struct){
   218       c: (struct){
   219@@ -104,7 +109,4 @@
   220       }
   221     }
   222   }
   223-  bar: (struct){
   224-    a: (int){ 1 }
   225-  }
   226 }
   227-- diff/todo/p2 --
   228Added near-duplicate message
   229-- out/eval --
   230Errors:
   231invalid interpolation: conflicting values 2 and 1:
   232    ./in.cue:12:28
   233    ./in.cue:12:31
   234    ./in.cue:12:35
   235
   236Result:
   237(_|_){
   238  // [eval]
   239  constraints: (struct){
   240    t1: (string){ "foo" }
   241    t2: (string){ "bar" }
   242    foo?: (struct){
   243      bar!: (int){ 3 }
   244    }
   245  }
   246  a: (string){ "foo" }
   247  e: (int){ 2 }
   248  b: (string){ "bar" }
   249  c: (struct){
   250    a: (int){ 1 }
   251  }
   252  withError: (_|_){
   253    // [eval]
   254    issue799: (_|_){
   255      // [eval] invalid interpolation: conflicting values 2 and 1:
   256      //     ./in.cue:12:28
   257      //     ./in.cue:12:31
   258      //     ./in.cue:12:35
   259      key: (int){ &(>=-2147483648, <=2147483647, int) }
   260    }
   261  }
   262  parenExprRefParent: (struct){
   263    a: (struct){
   264      foo: (struct){
   265      }
   266    }
   267    x: (string){ "foo" }
   268  }
   269  parenExprRefEqual: (struct){
   270    x: (string){ "foo" }
   271    foo: (struct){
   272    }
   273  }
   274  chainedResolution: (struct){
   275    p1: (struct){
   276      baz: (string){ "foo" }
   277      foo: (string){ "bar" }
   278      bar: (string){ "baz" }
   279    }
   280    p2: (struct){
   281      baz: (string){ "foo" }
   282      foo: (string){ "bar" }
   283      bar: (string){ "baz" }
   284    }
   285    p3: (struct){
   286      baz: (string){ "foo" }
   287      foo: (string){ "bar" }
   288      bar: (string){ "baz" }
   289    }
   290    p4: (struct){
   291      baz: (string){ "foo" }
   292      foo: (string){ "bar" }
   293      bar: (string){ "baz" }
   294    }
   295    p5: (struct){
   296      baz: (string){ "foo" }
   297      foo: (string){ "bar" }
   298      bar: (string){ "baz" }
   299    }
   300    p6: (struct){
   301      baz: (string){ "foo" }
   302      foo: (string){ "bar" }
   303      bar: (string){ "baz" }
   304    }
   305  }
   306  noCycleError: (struct){
   307    foo: (struct){
   308      bar: (struct){
   309        entries: (_|_){
   310          // [incomplete] noCycleError.foo.baz.#ID: invalid interpolation: non-concrete value string (type string):
   311          //     ./in.cue:59:8
   312          //     ./in.cue:59:11
   313        }
   314        #ID: (_|_){
   315          // [incomplete] noCycleError.foo.bar.#ID: invalid interpolation: non-concrete value string (type string):
   316          //     ./in.cue:59:8
   317          //     ./in.cue:59:11
   318        }
   319      }
   320      baz: (struct){
   321        #ID: (_|_){
   322          // [incomplete] noCycleError.foo.baz.#ID: invalid interpolation: non-concrete value string (type string):
   323          //     ./in.cue:59:8
   324          //     ./in.cue:59:11
   325        }
   326      }
   327    }
   328  }
   329  foo: (struct){
   330    b: (struct){
   331      c: (struct){
   332        d: (int){ 2 }
   333      }
   334    }
   335  }
   336  bar: (struct){
   337    a: (int){ 1 }
   338  }
   339}
   340-- out/compile --
   341--- constraints.cue
   342{
   343  constraints: {
   344    t1: "foo"
   345    t2: "bar"
   346    〈0;t1〉?: {
   347      〈1;t2〉!: 3
   348    }
   349  }
   350}
   351--- in.cue
   352{
   353  a: "foo"
   354  "\(〈0;a〉)": {
   355    b: {
   356      c: {
   357        d: 〈3;e〉
   358      }
   359    }
   360  }
   361  e: 2
   362  b: "bar"
   363  "\(〈0;b〉)": {
   364    a: 1
   365  }
   366  c: 〈0;("\(〈0;b〉)")〉
   367  withError: {
   368    issue799: ({
   369      key: &(int, >=-2147483648, <=2147483647)
   370    } & {
   371      "\((1 & 2))": 123
   372    })
   373  }
   374  parenExprRefParent: {
   375    a: {
   376      〈1;x〉: {}
   377    }
   378    x: "foo"
   379  }
   380  parenExprRefEqual: {
   381    〈0;x〉: {}
   382    x: "foo"
   383  }
   384  chainedResolution: {
   385    p1: {
   386      〈1;p1〉.baz: "bar"
   387      〈1;p1〉.foo: "baz"
   388      baz: "foo"
   389    }
   390    p2: {
   391      〈1;p2〉.baz: "bar"
   392      baz: "foo"
   393      〈1;p2〉.foo: "baz"
   394    }
   395    p3: {
   396      baz: "foo"
   397      〈1;p3〉.baz: "bar"
   398      〈1;p3〉.foo: "baz"
   399    }
   400    p4: {
   401      〈1;p4〉.foo: "baz"
   402      〈1;p4〉.baz: "bar"
   403      baz: "foo"
   404    }
   405    p5: {
   406      〈1;p5〉.foo: "baz"
   407      baz: "foo"
   408      〈1;p5〉.baz: "bar"
   409    }
   410    p6: {
   411      baz: "foo"
   412      〈1;p6〉.foo: "baz"
   413      〈1;p6〉.baz: "bar"
   414    }
   415  }
   416  noCycleError: {
   417    foo: {
   418      [_]: {
   419        #ID: "\(string)"
   420      }
   421    }
   422    foo: {
   423      bar: {
   424        entries: {
   425          〈3;foo〉.baz.#ID: true
   426        }
   427      }
   428    }
   429    foo: {
   430      baz: {}
   431    }
   432  }
   433}

View as plain text