...

Text file src/cuelang.org/go/cue/testdata/cycle/constraints.txtar

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

     1-- in.cue --
     2// Not a cycle: the structure in x (c) only triggers one further
     3// instantiation of y, but not enough to trigger another round.
     4safeCycle: simple2: {
     5	y: [string]: b: c: y
     6	x: y
     7	x: c: y
     8}
     9
    10// Not a cycle: the structure in x (c) only triggers one further
    11// instantiation of y, but not enough to trigger another round.
    12safeCycle: long1: {
    13	y: [string]: b: y
    14	x: y
    15	x: c: b: e: b: c: _
    16}
    17
    18// Not a cycle: the structure in x (c) only triggers one further
    19// instantiation of y, but not enough to trigger another round.
    20safeCycle: long2: {
    21	a: [string]: b: a
    22	x: a
    23	x: c: b: c: b: c: {}
    24}
    25
    26// noCyclePattern is similar to the above cases, but involving more patterns
    27// and various lengths.
    28noCyclePattern: _
    29
    30noCyclePattern: t1: {
    31	#D: [string]: #D
    32	a: {}
    33	[string]: #D
    34	[string]: b: c: {}
    35}
    36
    37noCyclePattern: t2: {
    38	#D: [string]: x: #D
    39	a: {}
    40	[string]: #D
    41	[string]: b: x: c: {}
    42}
    43
    44noCyclePattern: t3: {
    45	_D: [string]: _T
    46	_T: x: _D
    47	[string]: _D
    48	[string]: b: x: c: {}
    49	a: {}
    50}
    51
    52noCyclePattern: t4: {
    53	_D: [string]: x: _T
    54	_T: y: _D
    55	[string]: _D
    56	[string]: b: x: {}
    57	a: {}
    58}
    59
    60noCyclePattern: t5: {
    61	_D: [string]: x: _T
    62	_T: y: _D
    63	[string]: _D
    64	[string]: b: x: y: c: x: {}
    65	a: {}
    66}
    67
    68// This example also has an embedding, in which case it should still behave
    69// the same.
    70noCyclePattern: t6: {
    71	#D: [string]: #E
    72
    73	#E: t: #T
    74
    75	#T: {
    76		{ object: #S }
    77	}
    78
    79	#S: y: #D
    80	[string]: x: #D
    81	[string]: x: r: t: object: y: foo: t: object: {
    82	}
    83	bar: {}
    84}
    85
    86// Cycle: x cyclic. The pattern constraint should not be seen as
    87// "adding new structure", thereby permitting the cycle.
    88noCancelSelfInvoke: t1: {
    89	y: [string]: b: y
    90	x: y
    91	x: c: x
    92}
    93
    94
    95// Even though these cycles cross pattern boundaries, they are still structural
    96// cycles as the reference includes a field that triggers the pattern.
    97selfTriggerCycle: _
    98
    99// TODO: This does not show an explicit cycle within `a`, only a "child" cycle.
   100// However, upon investigation this error is present in the tree. Either way,
   101// the error only needs to be reported once, so this is not a huge problem.
   102selfTriggerCycle: t1: {
   103	a: #T
   104	#T: {
   105		[string]: #T
   106		b: {}
   107	}
   108}
   109
   110selfTriggerCycle: t2: {
   111	#T: [string]: X={
   112		a: X
   113	}
   114	b: #T
   115	b: c: {}
   116}
   117
   118selfTriggerCycle: long1: {
   119	// The long string of nested fields will initially exempt the structural
   120	// cycle, but they will eventually run out, causing the cycle to be
   121	// triggered.
   122	a: [string]: b: a     // -> record conjunct from pattern per field.
   123	a: c: b: c: b: c: {}  // -> track if any of the fields is not a cycle.
   124}
   125
   126// TODO: see comment at selfTriggerCycle.t1
   127selfTriggerCycle: issue1503: {
   128	a: #T & {
   129		a: one: link: a: two: {}
   130	}
   131	#T: {
   132		a: [string]: link: #T
   133		a: b: {}
   134	}
   135}
   136
   137mutuallyTriggeringCycle: t1: {
   138	// Even though y itself, as well as each of the x fields are not cyclic,
   139	// the combination of the two x conjuncts are, as the b fields of y will
   140	// trigger the pattern constraints in an interleaved fashion.
   141	y: [string]: b: y
   142	x: y
   143	x: c: y
   144}
   145
   146-- out/compile --
   147--- in.cue
   148{
   149  safeCycle: {
   150    simple2: {
   151      y: {
   152        [string]: {
   153          b: {
   154            c: 〈3;y〉
   155          }
   156        }
   157      }
   158      x: 〈0;y〉
   159      x: {
   160        c: 〈1;y〉
   161      }
   162    }
   163  }
   164  safeCycle: {
   165    long1: {
   166      y: {
   167        [string]: {
   168          b: 〈2;y〉
   169        }
   170      }
   171      x: 〈0;y〉
   172      x: {
   173        c: {
   174          b: {
   175            e: {
   176              b: {
   177                c: _
   178              }
   179            }
   180          }
   181        }
   182      }
   183    }
   184  }
   185  safeCycle: {
   186    long2: {
   187      a: {
   188        [string]: {
   189          b: 〈2;a〉
   190        }
   191      }
   192      x: 〈0;a〉
   193      x: {
   194        c: {
   195          b: {
   196            c: {
   197              b: {
   198                c: {}
   199              }
   200            }
   201          }
   202        }
   203      }
   204    }
   205  }
   206  noCyclePattern: _
   207  noCyclePattern: {
   208    t1: {
   209      #D: {
   210        [string]: 〈1;#D〉
   211      }
   212      a: {}
   213      [string]: 〈0;#D〉
   214      [string]: {
   215        b: {
   216          c: {}
   217        }
   218      }
   219    }
   220  }
   221  noCyclePattern: {
   222    t2: {
   223      #D: {
   224        [string]: {
   225          x: 〈2;#D〉
   226        }
   227      }
   228      a: {}
   229      [string]: 〈0;#D〉
   230      [string]: {
   231        b: {
   232          x: {
   233            c: {}
   234          }
   235        }
   236      }
   237    }
   238  }
   239  noCyclePattern: {
   240    t3: {
   241      _D: {
   242        [string]: 〈1;_T〉
   243      }
   244      _T: {
   245        x: 〈1;_D〉
   246      }
   247      [string]: 〈0;_D〉
   248      [string]: {
   249        b: {
   250          x: {
   251            c: {}
   252          }
   253        }
   254      }
   255      a: {}
   256    }
   257  }
   258  noCyclePattern: {
   259    t4: {
   260      _D: {
   261        [string]: {
   262          x: 〈2;_T〉
   263        }
   264      }
   265      _T: {
   266        y: 〈1;_D〉
   267      }
   268      [string]: 〈0;_D〉
   269      [string]: {
   270        b: {
   271          x: {}
   272        }
   273      }
   274      a: {}
   275    }
   276  }
   277  noCyclePattern: {
   278    t5: {
   279      _D: {
   280        [string]: {
   281          x: 〈2;_T〉
   282        }
   283      }
   284      _T: {
   285        y: 〈1;_D〉
   286      }
   287      [string]: 〈0;_D〉
   288      [string]: {
   289        b: {
   290          x: {
   291            y: {
   292              c: {
   293                x: {}
   294              }
   295            }
   296          }
   297        }
   298      }
   299      a: {}
   300    }
   301  }
   302  noCyclePattern: {
   303    t6: {
   304      #D: {
   305        [string]: 〈1;#E〉
   306      }
   307      #E: {
   308        t: 〈1;#T〉
   309      }
   310      #T: {
   311        {
   312          object: 〈2;#S〉
   313        }
   314      }
   315      #S: {
   316        y: 〈1;#D〉
   317      }
   318      [string]: {
   319        x: 〈1;#D〉
   320      }
   321      [string]: {
   322        x: {
   323          r: {
   324            t: {
   325              object: {
   326                y: {
   327                  foo: {
   328                    t: {
   329                      object: {}
   330                    }
   331                  }
   332                }
   333              }
   334            }
   335          }
   336        }
   337      }
   338      bar: {}
   339    }
   340  }
   341  noCancelSelfInvoke: {
   342    t1: {
   343      y: {
   344        [string]: {
   345          b: 〈2;y〉
   346        }
   347      }
   348      x: 〈0;y〉
   349      x: {
   350        c: 〈1;x〉
   351      }
   352    }
   353  }
   354  selfTriggerCycle: _
   355  selfTriggerCycle: {
   356    t1: {
   357      a: 〈0;#T〉
   358      #T: {
   359        [string]: 〈1;#T〉
   360        b: {}
   361      }
   362    }
   363  }
   364  selfTriggerCycle: {
   365    t2: {
   366      #T: {
   367        [string]: {
   368          a: 〈1〉
   369        }
   370      }
   371      b: 〈0;#T〉
   372      b: {
   373        c: {}
   374      }
   375    }
   376  }
   377  selfTriggerCycle: {
   378    long1: {
   379      a: {
   380        [string]: {
   381          b: 〈2;a〉
   382        }
   383      }
   384      a: {
   385        c: {
   386          b: {
   387            c: {
   388              b: {
   389                c: {}
   390              }
   391            }
   392          }
   393        }
   394      }
   395    }
   396  }
   397  selfTriggerCycle: {
   398    issue1503: {
   399      a: (〈0;#T〉 & {
   400        a: {
   401          one: {
   402            link: {
   403              a: {
   404                two: {}
   405              }
   406            }
   407          }
   408        }
   409      })
   410      #T: {
   411        a: {
   412          [string]: {
   413            link: 〈3;#T〉
   414          }
   415        }
   416        a: {
   417          b: {}
   418        }
   419      }
   420    }
   421  }
   422  mutuallyTriggeringCycle: {
   423    t1: {
   424      y: {
   425        [string]: {
   426          b: 〈2;y〉
   427        }
   428      }
   429      x: 〈0;y〉
   430      x: {
   431        c: 〈1;y〉
   432      }
   433    }
   434  }
   435}
   436-- out/eval/stats --
   437Leaks:  0
   438Freed:  143
   439Reused: 130
   440Allocs: 13
   441Retain: 4
   442
   443Unifications: 143
   444Conjuncts:    321
   445Disjuncts:    147
   446-- out/evalalpha --
   447Errors:
   448mutuallyTriggeringCycle.t1.x.c.b.b.b.b.b.b: structural cycle
   449noCancelSelfInvoke.t1.x.c.b.b.b: structural cycle
   450noCancelSelfInvoke.t1.x.c.c: structural cycle
   451selfTriggerCycle.issue1503.#T.a.b.link: structural cycle
   452selfTriggerCycle.issue1503.a.a.b.link.a.b.link.a.b.link: structural cycle
   453selfTriggerCycle.issue1503.a.a.one.link.a.b.link.a.b.link: structural cycle
   454selfTriggerCycle.issue1503.a.a.one.link.a.two.link.a.b.link: structural cycle
   455selfTriggerCycle.long1.a.c.b.c.b.c.b.c.b: structural cycle
   456selfTriggerCycle.t1.#T.b.b: structural cycle
   457selfTriggerCycle.t1.a.b.b.b: structural cycle
   458selfTriggerCycle.t2.b.c.a: structural cycle
   459
   460Result:
   461(_|_){
   462  // [structural cycle]
   463  safeCycle: (struct){
   464    simple2: (struct){
   465      y: (struct){
   466      }
   467      x: (struct){
   468        c: (struct){
   469          b: (struct){
   470            c: (struct){
   471            }
   472            b: (struct){
   473              c: (struct){
   474              }
   475            }
   476          }
   477        }
   478      }
   479    }
   480    long1: (struct){
   481      y: (struct){
   482      }
   483      x: (struct){
   484        c: (struct){
   485          b: (struct){
   486            e: (struct){
   487              b: (struct){
   488                c: (struct){
   489                  b: (struct){
   490                  }
   491                }
   492              }
   493            }
   494          }
   495        }
   496      }
   497    }
   498    long2: (struct){
   499      a: (struct){
   500      }
   501      x: (struct){
   502        c: (struct){
   503          b: (struct){
   504            c: (struct){
   505              b: (struct){
   506                c: (struct){
   507                  b: (struct){
   508                  }
   509                }
   510              }
   511            }
   512          }
   513        }
   514      }
   515    }
   516  }
   517  noCyclePattern: (struct){
   518    t1: (struct){
   519      #D: (#struct){
   520      }
   521      a: (#struct){
   522        b: (#struct){
   523          c: (#struct){
   524          }
   525        }
   526      }
   527    }
   528    t2: (struct){
   529      #D: (#struct){
   530      }
   531      a: (#struct){
   532        b: (#struct){
   533          x: (#struct){
   534            c: (#struct){
   535              x: (#struct){
   536              }
   537            }
   538          }
   539        }
   540      }
   541    }
   542    t3: (struct){
   543      _D: (struct){
   544      }
   545      _T: (struct){
   546        x: (struct){
   547        }
   548      }
   549      a: (struct){
   550        b: (struct){
   551          x: (struct){
   552            c: (struct){
   553              x: (struct){
   554              }
   555            }
   556          }
   557        }
   558      }
   559    }
   560    t4: (struct){
   561      _D: (struct){
   562      }
   563      _T: (struct){
   564        y: (struct){
   565        }
   566      }
   567      a: (struct){
   568        b: (struct){
   569          x: (struct){
   570            y: (struct){
   571            }
   572          }
   573        }
   574      }
   575    }
   576    t5: (struct){
   577      _D: (struct){
   578      }
   579      _T: (struct){
   580        y: (struct){
   581        }
   582      }
   583      a: (struct){
   584        b: (struct){
   585          x: (struct){
   586            y: (struct){
   587              c: (struct){
   588                x: (struct){
   589                  y: (struct){
   590                  }
   591                }
   592              }
   593            }
   594          }
   595        }
   596      }
   597    }
   598    t6: (struct){
   599      #D: (#struct){
   600      }
   601      #E: (#struct){
   602        t: (#struct){
   603          object: (#struct){
   604            y: (#struct){
   605            }
   606          }
   607        }
   608      }
   609      #T: (#struct){
   610        object: (#struct){
   611          y: (#struct){
   612          }
   613        }
   614      }
   615      #S: (#struct){
   616        y: (#struct){
   617        }
   618      }
   619      bar: (struct){
   620        x: (#struct){
   621          r: (#struct){
   622            t: (#struct){
   623              object: (#struct){
   624                y: (#struct){
   625                  foo: (#struct){
   626                    t: (#struct){
   627                      object: (#struct){
   628                        y: (#struct){
   629                        }
   630                      }
   631                    }
   632                  }
   633                }
   634              }
   635            }
   636          }
   637        }
   638      }
   639    }
   640  }
   641  noCancelSelfInvoke: (_|_){
   642    // [structural cycle]
   643    t1: (_|_){
   644      // [structural cycle]
   645      y: (struct){
   646      }
   647      x: (_|_){
   648        // [structural cycle]
   649        c: (_|_){
   650          // [structural cycle]
   651          b: (_|_){
   652            // [structural cycle]
   653            b: (_|_){
   654              // [structural cycle]
   655              b: (_|_){
   656                // [structural cycle] noCancelSelfInvoke.t1.x.c.b.b.b: structural cycle
   657              }
   658            }
   659          }
   660          c: (_|_){
   661            // [structural cycle] noCancelSelfInvoke.t1.x.c.c: structural cycle
   662          }
   663        }
   664      }
   665    }
   666  }
   667  selfTriggerCycle: (_|_){
   668    // [structural cycle]
   669    t1: (_|_){
   670      // [structural cycle]
   671      a: (_|_){
   672        // [structural cycle]
   673        b: (_|_){
   674          // [structural cycle]
   675          b: (_|_){
   676            // [structural cycle]
   677            b: (_|_){
   678              // [structural cycle] selfTriggerCycle.t1.a.b.b.b: structural cycle
   679            }
   680          }
   681        }
   682      }
   683      #T: (_|_){
   684        // [structural cycle]
   685        b: (_|_){
   686          // [structural cycle]
   687          b: (_|_){
   688            // [structural cycle] selfTriggerCycle.t1.#T.b.b: structural cycle
   689          }
   690        }
   691      }
   692    }
   693    t2: (_|_){
   694      // [structural cycle]
   695      #T: (#struct){
   696      }
   697      b: (_|_){
   698        // [structural cycle]
   699        c: (_|_){
   700          // [structural cycle]
   701          a: (_|_){
   702            // [structural cycle] selfTriggerCycle.t2.b.c.a: structural cycle
   703          }
   704        }
   705      }
   706    }
   707    long1: (_|_){
   708      // [structural cycle]
   709      a: (_|_){
   710        // [structural cycle]
   711        c: (_|_){
   712          // [structural cycle]
   713          b: (_|_){
   714            // [structural cycle]
   715            c: (_|_){
   716              // [structural cycle]
   717              b: (_|_){
   718                // [structural cycle]
   719                c: (_|_){
   720                  // [structural cycle]
   721                  b: (_|_){
   722                    // [structural cycle]
   723                    c: (_|_){
   724                      // [structural cycle]
   725                      b: (_|_){
   726                        // [structural cycle] selfTriggerCycle.long1.a.c.b.c.b.c.b.c.b: structural cycle
   727                      }
   728                    }
   729                  }
   730                }
   731              }
   732            }
   733          }
   734        }
   735      }
   736    }
   737    issue1503: (_|_){
   738      // [structural cycle]
   739      a: (_|_){
   740        // [structural cycle]
   741        a: (_|_){
   742          // [structural cycle]
   743          one: (_|_){
   744            // [structural cycle]
   745            link: (_|_){
   746              // [structural cycle]
   747              a: (_|_){
   748                // [structural cycle]
   749                two: (_|_){
   750                  // [structural cycle]
   751                  link: (_|_){
   752                    // [structural cycle]
   753                    a: (_|_){
   754                      // [structural cycle]
   755                      b: (_|_){
   756                        // [structural cycle]
   757                        link: (_|_){
   758                          // [structural cycle] selfTriggerCycle.issue1503.a.a.one.link.a.two.link.a.b.link: structural cycle
   759                        }
   760                      }
   761                    }
   762                  }
   763                }
   764                b: (_|_){
   765                  // [structural cycle]
   766                  link: (_|_){
   767                    // [structural cycle]
   768                    a: (_|_){
   769                      // [structural cycle]
   770                      b: (_|_){
   771                        // [structural cycle]
   772                        link: (_|_){
   773                          // [structural cycle] selfTriggerCycle.issue1503.a.a.one.link.a.b.link.a.b.link: structural cycle
   774                        }
   775                      }
   776                    }
   777                  }
   778                }
   779              }
   780            }
   781          }
   782          b: (_|_){
   783            // [structural cycle]
   784            link: (_|_){
   785              // [structural cycle]
   786              a: (_|_){
   787                // [structural cycle]
   788                b: (_|_){
   789                  // [structural cycle]
   790                  link: (_|_){
   791                    // [structural cycle]
   792                    a: (_|_){
   793                      // [structural cycle]
   794                      b: (_|_){
   795                        // [structural cycle]
   796                        link: (_|_){
   797                          // [structural cycle] selfTriggerCycle.issue1503.a.a.b.link.a.b.link.a.b.link: structural cycle
   798                        }
   799                      }
   800                    }
   801                  }
   802                }
   803              }
   804            }
   805          }
   806        }
   807      }
   808      #T: (_|_){
   809        // [structural cycle]
   810        a: (_|_){
   811          // [structural cycle]
   812          b: (_|_){
   813            // [structural cycle]
   814            link: (_|_){
   815              // [structural cycle] selfTriggerCycle.issue1503.#T.a.b.link: structural cycle
   816            }
   817          }
   818        }
   819      }
   820    }
   821  }
   822  mutuallyTriggeringCycle: (_|_){
   823    // [structural cycle]
   824    t1: (_|_){
   825      // [structural cycle]
   826      y: (struct){
   827      }
   828      x: (_|_){
   829        // [structural cycle]
   830        c: (_|_){
   831          // [structural cycle]
   832          b: (_|_){
   833            // [structural cycle]
   834            b: (_|_){
   835              // [structural cycle]
   836              b: (_|_){
   837                // [structural cycle]
   838                b: (_|_){
   839                  // [structural cycle]
   840                  b: (_|_){
   841                    // [structural cycle]
   842                    b: (_|_){
   843                      // [structural cycle] mutuallyTriggeringCycle.t1.x.c.b.b.b.b.b.b: structural cycle
   844                    }
   845                  }
   846                }
   847              }
   848            }
   849          }
   850        }
   851      }
   852    }
   853  }
   854}
   855-- diff/-out/evalalpha<==>+out/eval --
   856diff old new
   857--- old
   858+++ new
   859@@ -1,10 +1,14 @@
   860 Errors:
   861-mutuallyTriggeringCycle.t1.x.c.b.b.b.b: structural cycle
   862+mutuallyTriggeringCycle.t1.x.c.b.b.b.b.b.b: structural cycle
   863 noCancelSelfInvoke.t1.x.c.b.b.b: structural cycle
   864 noCancelSelfInvoke.t1.x.c.c: structural cycle
   865 selfTriggerCycle.issue1503.#T.a.b.link: structural cycle
   866+selfTriggerCycle.issue1503.a.a.b.link.a.b.link.a.b.link: structural cycle
   867+selfTriggerCycle.issue1503.a.a.one.link.a.b.link.a.b.link: structural cycle
   868+selfTriggerCycle.issue1503.a.a.one.link.a.two.link.a.b.link: structural cycle
   869 selfTriggerCycle.long1.a.c.b.c.b.c.b.c.b: structural cycle
   870 selfTriggerCycle.t1.#T.b.b: structural cycle
   871+selfTriggerCycle.t1.a.b.b.b: structural cycle
   872 selfTriggerCycle.t2.b.c.a: structural cycle
   873 
   874 Result:
   875@@ -198,18 +202,18 @@
   876         // [structural cycle]
   877         c: (_|_){
   878           // [structural cycle]
   879+          b: (_|_){
   880+            // [structural cycle]
   881+            b: (_|_){
   882+              // [structural cycle]
   883+              b: (_|_){
   884+                // [structural cycle] noCancelSelfInvoke.t1.x.c.b.b.b: structural cycle
   885+              }
   886+            }
   887+          }
   888           c: (_|_){
   889             // [structural cycle] noCancelSelfInvoke.t1.x.c.c: structural cycle
   890           }
   891-          b: (_|_){
   892-            // [structural cycle]
   893-            b: (_|_){
   894-              // [structural cycle]
   895-              b: (_|_){
   896-                // [structural cycle] noCancelSelfInvoke.t1.x.c.b.b.b: structural cycle
   897-              }
   898-            }
   899-          }
   900         }
   901       }
   902     }
   903@@ -222,6 +226,12 @@
   904         // [structural cycle]
   905         b: (_|_){
   906           // [structural cycle]
   907+          b: (_|_){
   908+            // [structural cycle]
   909+            b: (_|_){
   910+              // [structural cycle] selfTriggerCycle.t1.a.b.b.b: structural cycle
   911+            }
   912+          }
   913         }
   914       }
   915       #T: (_|_){
   916@@ -284,18 +294,65 @@
   917         // [structural cycle]
   918         a: (_|_){
   919           // [structural cycle]
   920-          b: (_|_){
   921-            // [structural cycle]
   922-            link: (_|_){
   923-              // [structural cycle]
   924-            }
   925-          }
   926           one: (_|_){
   927             // [structural cycle]
   928             link: (_|_){
   929               // [structural cycle]
   930-              a: (struct){
   931-                two: (struct){
   932+              a: (_|_){
   933+                // [structural cycle]
   934+                two: (_|_){
   935+                  // [structural cycle]
   936+                  link: (_|_){
   937+                    // [structural cycle]
   938+                    a: (_|_){
   939+                      // [structural cycle]
   940+                      b: (_|_){
   941+                        // [structural cycle]
   942+                        link: (_|_){
   943+                          // [structural cycle] selfTriggerCycle.issue1503.a.a.one.link.a.two.link.a.b.link: structural cycle
   944+                        }
   945+                      }
   946+                    }
   947+                  }
   948+                }
   949+                b: (_|_){
   950+                  // [structural cycle]
   951+                  link: (_|_){
   952+                    // [structural cycle]
   953+                    a: (_|_){
   954+                      // [structural cycle]
   955+                      b: (_|_){
   956+                        // [structural cycle]
   957+                        link: (_|_){
   958+                          // [structural cycle] selfTriggerCycle.issue1503.a.a.one.link.a.b.link.a.b.link: structural cycle
   959+                        }
   960+                      }
   961+                    }
   962+                  }
   963+                }
   964+              }
   965+            }
   966+          }
   967+          b: (_|_){
   968+            // [structural cycle]
   969+            link: (_|_){
   970+              // [structural cycle]
   971+              a: (_|_){
   972+                // [structural cycle]
   973+                b: (_|_){
   974+                  // [structural cycle]
   975+                  link: (_|_){
   976+                    // [structural cycle]
   977+                    a: (_|_){
   978+                      // [structural cycle]
   979+                      b: (_|_){
   980+                        // [structural cycle]
   981+                        link: (_|_){
   982+                          // [structural cycle] selfTriggerCycle.issue1503.a.a.b.link.a.b.link.a.b.link: structural cycle
   983+                        }
   984+                      }
   985+                    }
   986+                  }
   987                 }
   988               }
   989             }
   990@@ -333,7 +390,13 @@
   991               b: (_|_){
   992                 // [structural cycle]
   993                 b: (_|_){
   994-                  // [structural cycle] mutuallyTriggeringCycle.t1.x.c.b.b.b.b: structural cycle
   995+                  // [structural cycle]
   996+                  b: (_|_){
   997+                    // [structural cycle]
   998+                    b: (_|_){
   999+                      // [structural cycle] mutuallyTriggeringCycle.t1.x.c.b.b.b.b.b.b: structural cycle
  1000+                    }
  1001+                  }
  1002                 }
  1003               }
  1004             }
  1005-- diff/todo/p1 --
  1006issue1503: cycle detected too late
  1007mutuallyTriggeringCycle: cycle detected too late
  1008-- out/eval --
  1009Errors:
  1010mutuallyTriggeringCycle.t1.x.c.b.b.b.b: structural cycle
  1011noCancelSelfInvoke.t1.x.c.b.b.b: structural cycle
  1012noCancelSelfInvoke.t1.x.c.c: structural cycle
  1013selfTriggerCycle.issue1503.#T.a.b.link: structural cycle
  1014selfTriggerCycle.long1.a.c.b.c.b.c.b.c.b: structural cycle
  1015selfTriggerCycle.t1.#T.b.b: structural cycle
  1016selfTriggerCycle.t2.b.c.a: structural cycle
  1017
  1018Result:
  1019(_|_){
  1020  // [structural cycle]
  1021  safeCycle: (struct){
  1022    simple2: (struct){
  1023      y: (struct){
  1024      }
  1025      x: (struct){
  1026        c: (struct){
  1027          b: (struct){
  1028            c: (struct){
  1029            }
  1030            b: (struct){
  1031              c: (struct){
  1032              }
  1033            }
  1034          }
  1035        }
  1036      }
  1037    }
  1038    long1: (struct){
  1039      y: (struct){
  1040      }
  1041      x: (struct){
  1042        c: (struct){
  1043          b: (struct){
  1044            e: (struct){
  1045              b: (struct){
  1046                c: (struct){
  1047                  b: (struct){
  1048                  }
  1049                }
  1050              }
  1051            }
  1052          }
  1053        }
  1054      }
  1055    }
  1056    long2: (struct){
  1057      a: (struct){
  1058      }
  1059      x: (struct){
  1060        c: (struct){
  1061          b: (struct){
  1062            c: (struct){
  1063              b: (struct){
  1064                c: (struct){
  1065                  b: (struct){
  1066                  }
  1067                }
  1068              }
  1069            }
  1070          }
  1071        }
  1072      }
  1073    }
  1074  }
  1075  noCyclePattern: (struct){
  1076    t1: (struct){
  1077      #D: (#struct){
  1078      }
  1079      a: (#struct){
  1080        b: (#struct){
  1081          c: (#struct){
  1082          }
  1083        }
  1084      }
  1085    }
  1086    t2: (struct){
  1087      #D: (#struct){
  1088      }
  1089      a: (#struct){
  1090        b: (#struct){
  1091          x: (#struct){
  1092            c: (#struct){
  1093              x: (#struct){
  1094              }
  1095            }
  1096          }
  1097        }
  1098      }
  1099    }
  1100    t3: (struct){
  1101      _D: (struct){
  1102      }
  1103      _T: (struct){
  1104        x: (struct){
  1105        }
  1106      }
  1107      a: (struct){
  1108        b: (struct){
  1109          x: (struct){
  1110            c: (struct){
  1111              x: (struct){
  1112              }
  1113            }
  1114          }
  1115        }
  1116      }
  1117    }
  1118    t4: (struct){
  1119      _D: (struct){
  1120      }
  1121      _T: (struct){
  1122        y: (struct){
  1123        }
  1124      }
  1125      a: (struct){
  1126        b: (struct){
  1127          x: (struct){
  1128            y: (struct){
  1129            }
  1130          }
  1131        }
  1132      }
  1133    }
  1134    t5: (struct){
  1135      _D: (struct){
  1136      }
  1137      _T: (struct){
  1138        y: (struct){
  1139        }
  1140      }
  1141      a: (struct){
  1142        b: (struct){
  1143          x: (struct){
  1144            y: (struct){
  1145              c: (struct){
  1146                x: (struct){
  1147                  y: (struct){
  1148                  }
  1149                }
  1150              }
  1151            }
  1152          }
  1153        }
  1154      }
  1155    }
  1156    t6: (struct){
  1157      #D: (#struct){
  1158      }
  1159      #E: (#struct){
  1160        t: (#struct){
  1161          object: (#struct){
  1162            y: (#struct){
  1163            }
  1164          }
  1165        }
  1166      }
  1167      #T: (#struct){
  1168        object: (#struct){
  1169          y: (#struct){
  1170          }
  1171        }
  1172      }
  1173      #S: (#struct){
  1174        y: (#struct){
  1175        }
  1176      }
  1177      bar: (struct){
  1178        x: (#struct){
  1179          r: (#struct){
  1180            t: (#struct){
  1181              object: (#struct){
  1182                y: (#struct){
  1183                  foo: (#struct){
  1184                    t: (#struct){
  1185                      object: (#struct){
  1186                        y: (#struct){
  1187                        }
  1188                      }
  1189                    }
  1190                  }
  1191                }
  1192              }
  1193            }
  1194          }
  1195        }
  1196      }
  1197    }
  1198  }
  1199  noCancelSelfInvoke: (_|_){
  1200    // [structural cycle]
  1201    t1: (_|_){
  1202      // [structural cycle]
  1203      y: (struct){
  1204      }
  1205      x: (_|_){
  1206        // [structural cycle]
  1207        c: (_|_){
  1208          // [structural cycle]
  1209          c: (_|_){
  1210            // [structural cycle] noCancelSelfInvoke.t1.x.c.c: structural cycle
  1211          }
  1212          b: (_|_){
  1213            // [structural cycle]
  1214            b: (_|_){
  1215              // [structural cycle]
  1216              b: (_|_){
  1217                // [structural cycle] noCancelSelfInvoke.t1.x.c.b.b.b: structural cycle
  1218              }
  1219            }
  1220          }
  1221        }
  1222      }
  1223    }
  1224  }
  1225  selfTriggerCycle: (_|_){
  1226    // [structural cycle]
  1227    t1: (_|_){
  1228      // [structural cycle]
  1229      a: (_|_){
  1230        // [structural cycle]
  1231        b: (_|_){
  1232          // [structural cycle]
  1233        }
  1234      }
  1235      #T: (_|_){
  1236        // [structural cycle]
  1237        b: (_|_){
  1238          // [structural cycle]
  1239          b: (_|_){
  1240            // [structural cycle] selfTriggerCycle.t1.#T.b.b: structural cycle
  1241          }
  1242        }
  1243      }
  1244    }
  1245    t2: (_|_){
  1246      // [structural cycle]
  1247      #T: (#struct){
  1248      }
  1249      b: (_|_){
  1250        // [structural cycle]
  1251        c: (_|_){
  1252          // [structural cycle]
  1253          a: (_|_){
  1254            // [structural cycle] selfTriggerCycle.t2.b.c.a: structural cycle
  1255          }
  1256        }
  1257      }
  1258    }
  1259    long1: (_|_){
  1260      // [structural cycle]
  1261      a: (_|_){
  1262        // [structural cycle]
  1263        c: (_|_){
  1264          // [structural cycle]
  1265          b: (_|_){
  1266            // [structural cycle]
  1267            c: (_|_){
  1268              // [structural cycle]
  1269              b: (_|_){
  1270                // [structural cycle]
  1271                c: (_|_){
  1272                  // [structural cycle]
  1273                  b: (_|_){
  1274                    // [structural cycle]
  1275                    c: (_|_){
  1276                      // [structural cycle]
  1277                      b: (_|_){
  1278                        // [structural cycle] selfTriggerCycle.long1.a.c.b.c.b.c.b.c.b: structural cycle
  1279                      }
  1280                    }
  1281                  }
  1282                }
  1283              }
  1284            }
  1285          }
  1286        }
  1287      }
  1288    }
  1289    issue1503: (_|_){
  1290      // [structural cycle]
  1291      a: (_|_){
  1292        // [structural cycle]
  1293        a: (_|_){
  1294          // [structural cycle]
  1295          b: (_|_){
  1296            // [structural cycle]
  1297            link: (_|_){
  1298              // [structural cycle]
  1299            }
  1300          }
  1301          one: (_|_){
  1302            // [structural cycle]
  1303            link: (_|_){
  1304              // [structural cycle]
  1305              a: (struct){
  1306                two: (struct){
  1307                }
  1308              }
  1309            }
  1310          }
  1311        }
  1312      }
  1313      #T: (_|_){
  1314        // [structural cycle]
  1315        a: (_|_){
  1316          // [structural cycle]
  1317          b: (_|_){
  1318            // [structural cycle]
  1319            link: (_|_){
  1320              // [structural cycle] selfTriggerCycle.issue1503.#T.a.b.link: structural cycle
  1321            }
  1322          }
  1323        }
  1324      }
  1325    }
  1326  }
  1327  mutuallyTriggeringCycle: (_|_){
  1328    // [structural cycle]
  1329    t1: (_|_){
  1330      // [structural cycle]
  1331      y: (struct){
  1332      }
  1333      x: (_|_){
  1334        // [structural cycle]
  1335        c: (_|_){
  1336          // [structural cycle]
  1337          b: (_|_){
  1338            // [structural cycle]
  1339            b: (_|_){
  1340              // [structural cycle]
  1341              b: (_|_){
  1342                // [structural cycle]
  1343                b: (_|_){
  1344                  // [structural cycle] mutuallyTriggeringCycle.t1.x.c.b.b.b.b: structural cycle
  1345                }
  1346              }
  1347            }
  1348          }
  1349        }
  1350      }
  1351    }
  1352  }
  1353}

View as plain text