feat: deprecated parameter #399

Merged
argus merged 2 commits from loop/46-deprecated-parameter into main 2026-10-22 23:30:56 +00:00
Collaborator

Closes #46

Task

A parameter can carry the deprecated(...) clause; a call that passes it warns, and the lint rule renames the label.

What and why

  • deprecated("reason", replacement: "timeout", since: "0.4") stands on its own line in front of a parameter (parser enforces the own line, the formatter keeps the parameter below it).
  • Checker rules: the parameter has a default; replacement: names another parameter of the same function with the same type; passing both is an error; variadic, var, lazy, receiver-closure parameters and parameters of local functions cannot be deprecated.
  • A call that passes the argument by label or by position warns (connect(wait:) is deprecated since 0.4: ...) with a note naming the replacement; same exemptions as DEPRECATION.md section 3; --deny deprecated covers it.
  • torb lint --fix --rule deprecated rewrites the label wait: to timeout:; positional uses and calls passing both keep the finding.
  • Not in this step (recorded in DEPRECATION.md sections 5 and 6): the torb doc entry and the language server tag for parameters, tuple and case-field labels.
  • Docs: DEPRECATION.md, the deprecation page, torb-check, torb-lint, regenerated skills/.

Test

  • compiler/tests/deprecation.test.trb (parser, checker errors, warnings, --deny, lint fix) and compiler/tests/format.test.trb pass locally on the nightly (45 and 76 tests); torb check compiler clean, format --check on touched files, docs check --no-snippets and docs skill --check clean.
  • Gates, bootstrap and the docs snippets run in CI.

seed touch: no

Closes #46 ## Task A parameter can carry the `deprecated(...)` clause; a call that passes it warns, and the lint rule renames the label. ## What and why - `deprecated("reason", replacement: "timeout", since: "0.4")` stands on its own line in front of a parameter (parser enforces the own line, the formatter keeps the parameter below it). - Checker rules: the parameter has a default; `replacement:` names another parameter of the same function with the same type; passing both is an error; variadic, `var`, `lazy`, receiver-closure parameters and parameters of local functions cannot be deprecated. - A call that passes the argument by label or by position warns (`connect(wait:)` is deprecated since 0.4: ...) with a note naming the replacement; same exemptions as DEPRECATION.md section 3; `--deny deprecated` covers it. - `torb lint --fix --rule deprecated` rewrites the label `wait:` to `timeout:`; positional uses and calls passing both keep the finding. - Not in this step (recorded in DEPRECATION.md sections 5 and 6): the `torb doc` entry and the language server tag for parameters, tuple and case-field labels. - Docs: DEPRECATION.md, the deprecation page, torb-check, torb-lint, regenerated `skills/`. ## Test - `compiler/tests/deprecation.test.trb` (parser, checker errors, warnings, `--deny`, lint fix) and `compiler/tests/format.test.trb` pass locally on the nightly (45 and 76 tests); `torb check compiler` clean, `format --check` on touched files, `docs check --no-snippets` and `docs skill --check` clean. - Gates, bootstrap and the docs snippets run in CI. seed touch: no
A parameter carries the deprecated(...) clause on a line of its own in front of it. The checker holds the rules (default, same-typed replacement, not both passed, plain kinds) and warns at every call that passes it by label or position.
feat(lint): rename the label of a deprecated parameter
Some checks failed
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m20s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 1m58s
ci / every host emits the same C (pull_request) Successful in 4m45s
ci / pack the seed (pull_request) Successful in 12s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
images / cr.torb.dev/torbscript/registry (push) Has been skipped
images / cr.torb.dev/torbscript/release-sync (push) Has been skipped
images / cr.torb.dev/torbscript/site (push) Has been skipped
ci / commit messages (push) Successful in 4s
ci / what the change touches (push) Successful in 5s
pdisc / pdisc (push) Successful in 11s
images / cr.torb.dev/torbscript/site:edge (main) (push) Successful in 8m30s
ci / which runners exist (push) Successful in 1s
ci / bootstrap and conformance (windows-x64) (push) Has been skipped
ci / bootstrap and conformance (linux-arm64) (push) Has been skipped
ci / bootstrap and conformance (macos-arm64) (push) Has been skipped
ci / the VS Code extension (editors/vscode) (push) Successful in 13s
ci / gates (push) Has been cancelled
ci / tier A (linux-x64) (push) Has been cancelled
ci / tier B (linux-x64) (push) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (push) Has been cancelled
ci / cross-compiled on linux-x64 (windows-x64) (push) Has been cancelled
ci / cross-compiled on linux-x64 (linux-arm64) (push) Has been cancelled
ci / cross-compiled on linux-x64 (macos-arm64) (push) Has been cancelled
ci / every host emits the same C (push) Has been cancelled
ci / the playground (torb as WebAssembly) (push) Has been cancelled
ci / pack the seed (push) Has been cancelled
ci / archives (push) Has been cancelled
ci / bootstrap (linux-x64) (push) Has been cancelled
624f143f80
torb lint --fix --rule deprecated writes the label of the replacement over the label of a deprecated parameter. A positional argument and a call that passes both keep the finding.
argus approved these changes 2026-10-22 23:30:55 +00:00
argus left a comment

Approved. Checklist for head 624f143:

  • Tests: ok. deprecation.test.trb covers the parser (own-line rule), the checker errors (default, replacement, type, variadic/lazy/var, local functions), both-passed, warning by label and position, --deny, and the lint fix with the no-fix cases. format.test.trb covers layout. CI is green on this head (gates, bootstrap, tier A, pdisc).
  • Correctness: ok. Argument-to-parameter mapping uses the checker plan (targets) and drops the receiver; same-file uses are exempt as in DEPRECATION.md section 3; the fix is label-only and skipped for positional or both-passed calls.
  • Scope: ok. Matches #46 (design in DEPRECATION.md, checker warns at a use, lint --fix moves the label); the doc entry and language-server tag are explicitly deferred and recorded in the design record.
  • Security/data/workflows: nothing touched.
  • Docs: ok. DEPRECATION.md, deprecation page, torb-check, torb-lint and the regenerated skills/ copies are updated; pdisc is green.

Non-blocking:

  • [suggestion] deprecatedUsesOf no longer returns early when deprecations is empty, so every module is now walked for argument uses. If check time on large workspaces shows up, an early exit on "no function in the program has a deprecated parameter" would restore it.
Approved. Checklist for head 624f143: - Tests: ok. `deprecation.test.trb` covers the parser (own-line rule), the checker errors (default, replacement, type, variadic/lazy/var, local functions), both-passed, warning by label and position, `--deny`, and the lint fix with the no-fix cases. `format.test.trb` covers layout. CI is green on this head (gates, bootstrap, tier A, pdisc). - Correctness: ok. Argument-to-parameter mapping uses the checker plan (`targets`) and drops the receiver; same-file uses are exempt as in DEPRECATION.md section 3; the fix is label-only and skipped for positional or both-passed calls. - Scope: ok. Matches #46 (design in DEPRECATION.md, checker warns at a use, `lint --fix` moves the label); the doc entry and language-server tag are explicitly deferred and recorded in the design record. - Security/data/workflows: nothing touched. - Docs: ok. DEPRECATION.md, deprecation page, torb-check, torb-lint and the regenerated `skills/` copies are updated; pdisc is green. Non-blocking: - [suggestion] `deprecatedUsesOf` no longer returns early when `deprecations` is empty, so every module is now walked for argument uses. If check time on large workspaces shows up, an early exit on "no function in the program has a deprecated parameter" would restore it.
argus merged commit 624f143f80 into main 2026-10-22 23:30:56 +00:00
argus deleted branch loop/46-deprecated-parameter 2026-10-22 23:30:56 +00:00
Sign in to join this conversation.
No reviewers
No labels
loop
ready
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language!399
No description provided.