resolve.go holds reference resolution. Its site type and the free functions around it move out
separately, to the annotation package that reads them; what remains here is resolution itself.
Reference resolution is deliberately not promoted to compilers/compile: two of the three
compilers need it and they need it by different mechanisms, which is the shape that looks promotable
and is not.
Resolution recurses, so this package needs a bounded-recursion test: a deep or cyclic input must be
refused by an explicit depth counter rather than by exhausting the stack. The depth field moves
from the lowerer struct to an explicit parameter, which is what the bounded-recursion rule wants
regardless — and the risk of that change is a path that forgets to increment, which only a test
reaching that path will catch.
Acceptance
- The named files hold no
lowerer method.
- Golden output byte-identical, and the two-order and ID-collision oracles green.
- Any diagnostic-ordering change explained individually. Diagnostics move from central accumulation
to bottom-up returns, so some reordering is expected — each instance is understood, never absorbed
with -update.
- Table-driven unit tests built from a literal
Ctx and a fresh compile.NewTypes(0), needing no
document fixture.
- Coverage still exactly 100%.
Part of the Tier-1 conversion in docs/micro-compiler-design.md §5 and §8.1.
Also settle here: does the recursion guard belong in the framework?
docs/micro-compiler-design.md §3 lists the bounded-recursion guard as "promote only if the drafts
show need" and leaves the decision unassigned. This is where it becomes concrete, since depth stops
being a struct field here.
Check what the GraphQL (#20) and Protobuf (#21) drafts actually do about recursion depth before
deciding. The promotion rule is evidence from all three compilers, and the OpenAPI cap of 256 is
known to be wrong for an SDL-shaped source — which is an argument that the guard may be shared
while the cap stays per-compiler. Record the finding either way, so the next person does not
re-derive it.
resolve.goholds reference resolution. Itssitetype and the free functions around it move outseparately, to the annotation package that reads them; what remains here is resolution itself.
Reference resolution is deliberately not promoted to
compilers/compile: two of the threecompilers need it and they need it by different mechanisms, which is the shape that looks promotable
and is not.
Resolution recurses, so this package needs a bounded-recursion test: a deep or cyclic input must be
refused by an explicit depth counter rather than by exhausting the stack. The
depthfield movesfrom the
lowererstruct to an explicit parameter, which is what the bounded-recursion rule wantsregardless — and the risk of that change is a path that forgets to increment, which only a test
reaching that path will catch.
Acceptance
lowerermethod.to bottom-up returns, so some reordering is expected — each instance is understood, never absorbed
with
-update.Ctxand a freshcompile.NewTypes(0), needing nodocument fixture.
Part of the Tier-1 conversion in
docs/micro-compiler-design.md§5 and §8.1.Also settle here: does the recursion guard belong in the framework?
docs/micro-compiler-design.md§3 lists the bounded-recursion guard as "promote only if the draftsshow need" and leaves the decision unassigned. This is where it becomes concrete, since
depthstopsbeing a struct field here.
Check what the GraphQL (#20) and Protobuf (#21) drafts actually do about recursion depth before
deciding. The promotion rule is evidence from all three compilers, and the OpenAPI cap of 256 is
known to be wrong for an SDL-shaped source — which is an argument that the guard may be shared
while the cap stays per-compiler. Record the finding either way, so the next person does not
re-derive it.