Skip to content

Commit

Permalink
internal/core/adt: finalize arcs that are almost done
Browse files Browse the repository at this point in the history
See comments in code. This coincidentally also tightens
some structural cycles, which tends to have a positive effect
on performance.

Issue #1795

Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com>
Change-Id: Ida714373e549595c656b3033c7807d6c74d2fdbe
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/542678
Reviewed-by: Roger Peppe <rogpeppe@gmail.com>
Unity-Result: CUEcueckoo <cueckoo@cuelang.org>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
  • Loading branch information
mpvl committed Aug 25, 2022
1 parent 37ee967 commit 8ee1127
Show file tree
Hide file tree
Showing 3 changed files with 226 additions and 193 deletions.
74 changes: 6 additions & 68 deletions cue/testdata/cycle/constraints.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ noCancelSelfInvoke: t1: {
// cycles as the reference includes a field that triggers the pattern.
selfTriggerCycle: _

// TODO: This does not show an explicit cycle within `a`, only a "child" cycle.
// However, upon investigation this error is present in the tree. Either way,
// the error only needs to be reported once, so this is not a huge problem.
selfTriggerCycle: t1: {
a: #T
#T: {
Expand All @@ -120,6 +123,7 @@ selfTriggerCycle: long1: {
a: c: b: c: b: c: {} // -> track if any of the fields is not a cycle.
}

// TODO: see comment at selfTriggerCycle.t1
selfTriggerCycle: issue1503: {
a: #T & {
a: one: link: a: two: {}
Expand Down Expand Up @@ -435,12 +439,8 @@ mutuallyTriggeringCycle.t1.x.c.b.b.b.b.b: structural cycle
noCancelSelfInvoke.t1.x.c.b.b.b: structural cycle
noCancelSelfInvoke.t1.x.c.c: structural cycle
selfTriggerCycle.issue1503.#T.a.b.link: structural cycle
selfTriggerCycle.issue1503.a.a.b.link.a.b.link.a.b.link: structural cycle
selfTriggerCycle.issue1503.a.a.one.link.a.b.link.a.b.link: structural cycle
selfTriggerCycle.issue1503.a.a.one.link.a.two.link.a.b.link.a.b.link: structural cycle
selfTriggerCycle.long1.a.c.b.c.b.c.b: structural cycle
selfTriggerCycle.t1.#T.b.b: structural cycle
selfTriggerCycle.t1.a.b.b.b: structural cycle
selfTriggerCycle.t2.b.c.a: structural cycle

Result:
Expand Down Expand Up @@ -658,12 +658,6 @@ Result:
// [structural cycle]
b: (_|_){
// [structural cycle]
b: (_|_){
// [structural cycle]
b: (_|_){
// [structural cycle] selfTriggerCycle.t1.a.b.b.b: structural cycle
}
}
}
}
#T: (_|_){
Expand Down Expand Up @@ -724,70 +718,14 @@ Result:
// [structural cycle]
link: (_|_){
// [structural cycle]
a: (_|_){
// [structural cycle]
b: (_|_){
// [structural cycle]
link: (_|_){
// [structural cycle]
a: (_|_){
// [structural cycle]
b: (_|_){
// [structural cycle]
link: (_|_){
// [structural cycle] selfTriggerCycle.issue1503.a.a.b.link.a.b.link.a.b.link: structural cycle
}
}
}
}
}
}
}
}
one: (_|_){
// [structural cycle]
link: (_|_){
// [structural cycle]
a: (_|_){
// [structural cycle]
two: (_|_){
// [structural cycle]
link: (_|_){
// [structural cycle]
a: (_|_){
// [structural cycle]
b: (_|_){
// [structural cycle]
link: (_|_){
// [structural cycle]
a: (_|_){
// [structural cycle]
b: (_|_){
// [structural cycle]
link: (_|_){
// [structural cycle] selfTriggerCycle.issue1503.a.a.one.link.a.two.link.a.b.link.a.b.link: structural cycle
}
}
}
}
}
}
}
}
b: (_|_){
// [structural cycle]
link: (_|_){
// [structural cycle]
a: (_|_){
// [structural cycle]
b: (_|_){
// [structural cycle]
link: (_|_){
// [structural cycle] selfTriggerCycle.issue1503.a.a.one.link.a.b.link.a.b.link: structural cycle
}
}
}
}
a: (struct){
two: (struct){
}
}
}
Expand Down
Loading

0 comments on commit 8ee1127

Please sign in to comment.