Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved Cycle Detection Logic #689

Conversation

InsertCreativityHere
Copy link
Member

@InsertCreativityHere InsertCreativityHere commented Dec 18, 2023

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.

Fixes #683.

Copy link
Member

@externl externl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@InsertCreativityHere InsertCreativityHere merged commit 299638d into icerpc:main Dec 19, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Recursive enum
2 participants