Skip to content

archtest: the recursion pin reads free functions only #224

Description

@OmarAlJarrah

loweringCallGraph in internal/archtest/recursion_test.go builds its graph from top-level functions with no receiver. Methods are skipped entirely.

Until #217 that was not quite true — it also read methods on the lowerer type, by receiver name. That type is gone, so the branch was dead and #210 removed it. What is left is a graph that cannot see a method at all.

What it misses today

anchorWalk.walk and anchorWalk.walkMapping in compilers/openapi/internal/schema/schema.go are mutually recursive: the mapping walk descends into values by calling walk, and walk dispatches mappings to walkMapping. That is a real recursion in the lowering, bounded by an explicit depth counter, and the pin says nothing about it.

Others in the same position, none of them currently recursive: serviceGroups.group/finalize, anchorIndex.sites.

Why it was left

#210 fixed the value-edge blind spot and its acceptance required the pinned sets to be unchanged, so that a real answer could be told from a re-baselined one. Adding methods changes them — anchorWalk becomes a fourth set — so it could not ride along without giving up that property.

What to decide

Whether a method belongs in this graph at all. The pin exists to say which lowerings cannot be moved or tested alone; anchorWalk's two methods are exactly that, so the answer is probably yes. If so:

  • Record methods under a name that cannot collide with a free function's (the graph refuses collisions rather than resolving them, so walk on two receivers must stay distinguishable).
  • Re-pin, with anchorWalk's set added and a note saying why it is allowed to be recursive.

Acceptance

  • The pinned sets name every mutual recursion among the lowerings, methods included.
  • Planting a method that closes a new cycle reddens the test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions