This PR fixes and improves the cycle detection logic.
1) Currently, the detector doesn't check inside of sequences, dictionaries, or results, so struct S { s: Sequence<S> } won't be caught.
This PR improves the detector to check these kinds of things.
2) Adds a path for the detector to check enums with fields for cycles.
(Currently it does not).
3) It adds logic to avoid outputting duplicate cycles:
A -> B -> A and B -> A -> B are really the same cycle, no point in outputting both.
We avoid duplicates by storing sets of cycle elements like {A, B}.
If we detect a cycle, and it's set of elements has already been reported, we don't report it again.
This PR fixes and improves the cycle detection logic. 1) Currently, the detector doesn't check inside of sequences, dictionaries, or results, so
struct S { s: Sequence<S> }
won't be caught. This PR improves the detector to check these kinds of things.2) Adds a path for the detector to check enums with fields for cycles. (Currently it does not).
3) It adds logic to avoid outputting duplicate cycles:
A -> B -> A
andB -> A -> B
are really the same cycle, no point in outputting both. We avoid duplicates by storing sets of cycle elements like{A, B}
. If we detect a cycle, and it's set of elements has already been reported, we don't report it again.Fixes #683.