cuelang.org/go@v0.10.1/cue/testdata/cycle/inline_non_recursive.txtar (about)

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