lint: a case written with its type where the expected type names it #168
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
The second rule
torb lintnames and does not build (torb-lint.md, "What is not decided", ROADMAPtorb lint): a case written with its type where the expected type already names it (DecisionNode.SwitchCase(path)for.SwitchCase(path)). Split from #9, which keeps the closure rule.Why it is not ready
The accepted record CLOSED-TRAITS, section 6 removes the leading dot: a case is written bare where the expected type names it, and phase 1a ("the largest mechanical change the repository has made since the
Iterablerename", with the seed in between) is not built. A rule that rewrites to.Casenow would sweep std and the compiler, and phase 1a would rewrite the same sites again. The decision is on this issue as an owner decision.Goal (once decided)
A rule that finds a case written with its type at a position where the expected type names it, with a
--fixthat writes the short spelling the decision names; std and the compiler swept clean (no off-by-default, #157); documented indocs/tooling/torb-lint.md.Acceptance criteria (draft, final after the decision)
--fix, and finds only positions where the checker's expected type names the case's type (annotation, argument, field default, result,==, arm of a typedmatch/if, typed collection element)docs/tooling/torb-lint.mdSize
The rule is one PR; the sweep may be a second one (about 1000 candidate sites in
stdandcompiler/src).[loop:torbscript] owner decision: which spelling should the rule "a case written with its type where the expected type names it" move code to, and when?
Facts: today
.Caseis the short form (cases-and-match rule 2; CONTRIBUTING: "Prefer the short form where the expected type says which type is meant"). The accepted record CLOSED-TRAITS section 6 removes.Casein favour of the bareCasein phase 1a, which is not built yet and needs a seed refresh. About 1000 candidate sites instdandcompiler/src.Options:
.Case, sweep now. Phase 1a later rewrites the same sites again (.Caseto bare); two big mechanical diffs.Type.Casestays the spelling where no type is known); remove the "named, not built" entry from the docs and the ROADMAP.Recommendation: 2 (or 3 if phase 1a is soon): no churn twice, and the target spelling is the one that stays.
Question q1 for torben (decision, blocking): Which spelling should the "case written with its type" lint rule move code to, and when?
[loop:torbscript] refine: owner decision filed (q1), next: waiting (owner decision q1)
[loop:torbscript] owner decision recorded (torben via WhatsApp, 2026-10-08 16:35 Europe/Berlin): "Okay, empfehulung akzeptiert" (option
wait-phase-1a).Resolution: the rule is built after phase 1a with the bare
Casetarget, one sweep. The issue stays blocked on phase 1a (notready); next: waiting (phase 1a), no owner question left.[owner-answer] q=q1 option=drop „Drop the rule“ 2026-10-29T22:52:43Z