Expand description
#2642: check --fix — apply the machine-applicable suggestions of a file or
project from the command line.
The selection rule is bynk_syntax::fix, the one the editor’s
source.fixAll.bynk uses, so the two cannot disagree about what a pass
takes. This module adds what a one-shot invocation needs and the editor
leaves to the user pressing fix-all again:
- A fixpoint (DECISION C). Re-check the edited text and re-apply until a
pass takes no edits, capped at
PASS_CAPpasses. Past the cap two fixes are undoing each other: the run is refused. - A gate (DECISION D). A pass is accepted only if every diagnostic it introduces carries a single machine-applicable fix, so the next pass can resolve it. Any other new diagnostic needs a human, and the run is refused. The editor’s gate is stricter (no new diagnostic at all) because it applies once; a fixpoint has to allow the cascade it exists for.
- Nothing written until the end (DECISION D/E). Every pass runs in memory over the source texts; only files whose text changed are written, in place, with no formatter pass.
Structs§
- FixPlan
- The outcome of a run that reached a fixpoint the gate accepted.
- Fixed
File - A file the run changed.
- Scope
- Which diagnostics’ fixes a run may take (#3537).
Enums§
- Refusal
- Why a run writes nothing.
Constants§
- PASS_
CAP - The most passes that may take edits. A fix that has not settled by then is two suggestions undoing each other.
Functions§
- plan_
file plan_file_inover every diagnosticcheckshows.- plan_
file_ in - Plan the fixes for a single
.bynkfile.Nonewhen the file cannot be read:checkreports that. - plan_
project plan_project_inover every diagnosticcheckshows.- plan_
project_ in - Plan the fixes for a project rooted at
input.Nonewhen the project cannot be set up (a bad manifest, an unreadable lock):checkreports that.