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

selectors: fix for edge case around recursion clauses with an immediate edge. #334

Merged
merged 1 commit into from
Jan 21, 2022

Commits on Jan 21, 2022

  1. selectors: fix for edge case around recursion clauses with an immedia…

    …te edge.
    
    See also the diff in the ipld/ipld repo for the new fixture,
    which includes some explanation.
    
    This would be a somewhat silly selector to write, but,
    it doesn't seem to be something we should reject at compile time, either;
    so, we must handle it gracefully.
    
    Along the way, I documented some code that was sparse in comments.
    
    I also added a shortcut to traversals so that a selector that
    explicitly states it's not interested in anything (by returning a
    non-nil but empty slice for its interests) is treated differently
    than a nil return for interests (which means "I don't know; hit me
    with everything you've got and lemme see").  This means that our
    edge case here with edges (...heh) doesn't cause the traversal
    to create an iterator that it doesn't really need, etc.
    
    We turn out to need both that shortcut, *and* less panicky methods on
    ExploreRecursiveEdge, *and* the edge case branch in ExploreRecursive...
    because traversals are pre-order.  Decide is called first, then
    Interests, and then Explore.  Therefore informing the Explore method
    alone about this situation is not sufficient.
    
    Previously, a recursion clause with an edge as its immediate and only
    child would get a passing grade by the compiler (same as now),
    but would panic when actually used (oh dear).
    warpfork committed Jan 21, 2022
    Configuration menu
    Copy the full SHA
    9e5da0e View commit details
    Browse the repository at this point in the history