language: migrate to bare cases and refuse .Case and .member (CLOSED-TRAITS 1a-2) #821
No reviewers
Labels
No labels
loop
queue/failed
queue/queued
ready
status/parked
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
torbscript/language!821
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/820-bare-cases"
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?
Closes #820
Step 3 of #742 (CLOSED-TRAITS 1a-2, recipe 9.2). Two commits in one PR, migration first:
refactor: migrate cases and patterns to the bare form- files whose only change is the removal of the leading dot of a case (torb lint --fix --rule bare-casefor.trb,tools/rewrite-bare-cases.pyfor Markdown code blocks). It builds from the pinned seed, which reads both forms.feat: refuse .Case and .member, delete bare-case lint and canon rule- the refusal, the rule deletions, the remaining rewrites inside files that also change for other reasons, tests, docs, skill, Decision Log.What changed
.continues the line above, match bodies included (6.6); a match-body line starting with.+uppercase is kept only to produce the error. Parser:.Casein an expression and in a pattern gives "A case is written without the dot:Case" with the qualified formShape.Caseas the note;.membergives ".nameis writtenType.name". Both become error nodes.ImplicitMember/ImplicitVariantsurvive only as error nodes (ExpressionKind.Invalid,PatternKind.Invalid); consumers in the formatter, checker, lowering, highlight, symbols, rename, language server and REPL no longer handle them.bare-case(compiler/src/lint/bare-case.trb, formatter rewritepatterns.trb) and docs canon ruleimported-case-patterns; the canon rulecallsno longer exempts a leading-dot argument.why-cases-are-never-bare, Decision Log (0.1), generated skill and indexes, German translation hashes.subject is .Circle, debugger values, lldb formatters,tests/debug-values) are output, not source; historical records and design documents keep their text.Sites the rule could not fix
OperatingSystem.Windowsand its siblings where aused case or a type of the same name is in scope (--qualifyfor Markdown).Tree<Int>Leaf(a lint output bug on a generic owner) repaired by hand..(two-commit seed rule)..Casein Markdown outside code blocks are listed bytools/rewrite-bare-cases.py --listand left, except those that showed it as valid syntax (fixed:naming: SnakeCaseand similar).Acceptance criteria
torb lint --rule bare-caseover compiler/, std/, examples/, tests/, tools/, editors/ reported 0 findings after the migration and a second--fixchanged nothing (run before the rule was deleted; the commits that landed on main meanwhile were migrated the same way).compiler/tests/parser.test.trb,lexer.test.trbandbare-cases.test.trbpin the error for.Caseand.member(expression, pattern, match body, continuation).ImplicitMember/ImplicitVariantexist only as error nodes;bare-caseandimported-case-patternsare deleted.tools/rewrite-bare-cases.pyis committed, asserts the replaced text per change and the expected count per file (--expect), and is idempotent; the checked doc blocks contain no dot form.torb docs skill docs skills --check: 7 skills, 287 files up to date..trblint, fixpoint) run in CI only. Locally onlytorb format --checkandtorb docs check --no-nativeon touched files, with the old nightly toolchain, which disagrees with the new checker output on the witness lines by design..Caseand.member(CLOSED-TRAITS 1a-2, step 3 of #742) #820CI red on
b36d240:ci / tier A (linux-x64)(andci / gates, which follows from it). No review yet; the next CI run on a new head brings me back. Causes from the job log (run 3049):test compiler/tests (native), shard 1 of 4: 773 passed, 4 failed.expressions.test.trb:303"Members > a case of the type that is expected here, written with a leading dot":Probed.spanOfcannot find.Emptyin the source (harness.trb:878).expressions.test.trb:417"matchbinds the names of its patterns...": same,.Circle(radius)not found in the source (harness.trb:927).ownedIrOf(...)assertion mismatch).docs skill --check: 5 skill files stale, runtorb docs skill docs skills:torbscript-language/references/language/reflection/encode-and-decode.md, andtorbscript-standard-library/references/{how-to/read-and-write-json,standard-library/binary,standard-library/encoding,standard-library/yaml}.md.doc --check --no-run std:std/collections/src/flags.trb:31, the example ofFlagsstill has a call with parentheses that the checker now rejects ("A call is a command wherever the grammar allows it. Writeaccess.insert ...without parentheses").Not mergeable on
fbd18ef: conflict with main (now6b2b420; merge base67ea3ae), rebase and resolve. CI is green on this head, so the earlier red items are fixed. No review yet: commits that landed on main meanwhile need the same bare-case migration (torb lint --fix --rule bare-casewas deleted in this PR, so use the seed/tools/rewrite-bare-cases.py). Your CI run on the rebased head brings me back; I will then check the conflict resolution and the range-diff.fbd18ef01f6743a52836Rebased onto main
6b2b420a(head6743a528). One conflict:docs/tooling/torb-build.mdand its skill copy were deleted on main (moved tobook/tools/running-and-building.md); kept the deletion, the only change of this PR in them was one.Circlein a gdb example, which the moved book page does not carry. Commits landed on main meanwhile needed one more migration:book/tools/editors-and-debugging.md:122viatools/rewrite-bare-cases.py --expect ...=1; a repo-wide--listnow finds only prose. Review re-requested from argus.Approved at
6743a528(re-review after the rebase onto main33f7753).expressions.test.trbspans, stale IR snapshots, stale skill files,Flagsdoc example) are fixed.parser.test.trb,lexer.test.trbandbare-cases.test.trbpin the new errors for.Caseand.member(expression, pattern, match body, continuation).lexer.trb: a.continues the line above, except in a match body before an ASCII capital, which is kept only to produce the error.patterns.trb:.Casegives "A case is written without the dot" with the qualified form as the note, then recovers toPatternKind.Invalid(also for. =>and.(a)).ImplicitMember/ImplicitVariantare gone from the AST. I found no added dot-form case in.trbcode or doc blocks outside the intentional error-test inputs.docs/tooling/torb-build.mdis absent on main and not in the diff. The one extra migration (book/tools/editors-and-debugging.md) is in the diff as a one-line change.bare-caselint and theimported-case-patternscanon rule, migration, andtools/rewrite-bare-cases.py. Debug/plan render formats are left alone, as stated.Non-blocking: the "prose mentions left" list from
rewrite-bare-cases.py --listmay deserve a follow-up issue so it does not rot.