Skip to content

v4.197.0

@jessegall jessegall tagged this 26 Jul 17:39
The layout sin is purely positional, so the fix is too: a `MemberAfterMethodScribe`
moves every stray trait use, constant, property and enum case to the head of its
class, just above the first method, carrying its docblock and attributes. The
strays of one class travel as a block, so a run split around a method keeps its
written order instead of coming back reversed.

The move op belongs to the ONE Writer, not the scribe: `Writer::moveBefore()`
relocates declarations above an anchor, with `declarationBounds()` taking the
blank line ABOVE each block so lifting it out closes the gap behind it. Original
bytes are re-inserted verbatim — nothing is reprinted, so formatting survives.

Proved against this morning's hand-run cleanup: reverting three of the swept files
and running `repent --only=MemberAfterMethodDetector` reproduces the committed
result byte-for-byte — and does it better in UntilGate, where the manual pass left
a blank line before the closing brace (that, plus three more like it, tidied here).
Assets 2
Loading