lean4-htt/tests/pkg
Wojciech Różowski 51e87865c5
feat: add deprecated_arg attribute (#13011)
This PR adds a `@[deprecated_arg]` attribute that marks individual
function parameters as deprecated. When a caller uses the old parameter
name, the elaborator emits a deprecation warning with a code action hint
to rename or delete the argument, and silently forwards the value to the
correct binder.

Supported forms:
- `@[deprecated_arg old new (since := "...")]` — renamed parameter,
warns and forwards
- `@[deprecated_arg old new "reason" (since := "...")]` — with custom
message
- `@[deprecated_arg removed (since := "...")]` — removed parameter,
errors with delete hint
- `@[deprecated_arg removed "reason" (since := "...")]` — removed with
custom message

A warning is emitted if `(since := "...")` is omitted.

When a parameter is deprecated without a replacement, the elaborator
treats it as no longer present: using it as a named argument produces an
error. Note that positional uses of deprecated arguments are not checked
— if a function's arity changed, the caller will simply get a "function
expected" error.

The `linter.deprecated.arg` option (default `true`) controls behavior:
when enabled, renamed args produce warnings and removed args produce
specific deprecation errors with code action hints; when disabled, both
fall through to the standard "invalid argument name" error. This lets
library authors phase out old parameter names without breaking
downstream code immediately.

Example (renamed parameter):
```lean
@[deprecated_arg old new (since := "2026-03-18")]
def f (new : Nat) : Nat := new

/--
warning: parameter `old` of `f` has been deprecated, use `new` instead

Hint: Rename this argument:
  o̵l̵d̵n̲e̲w̲
---
info: f 42 : Nat
-/
#guard_msgs in
#check f (old := 42)
```

Example (removed parameter):
```lean
@[deprecated_arg removed (since := "2026-03-18")]
def g (x : Nat) : Nat := x

/--
error: parameter `removed` of `g` has been deprecated

Hint: Delete this argument:
  (̵r̵e̵m̵o̵v̵e̵d̵ ̵:̵=̵ ̵4̵2̵)̵
-/
#guard_msgs in
#check g (removed := 42)
```
2026-03-30 10:20:44 +00:00
..
builtin_attr chore: improve how test suite interacts with stages (#12913) 2026-03-16 15:20:03 +00:00
cbv_attr chore: disable cbv usage warning (#12986) 2026-03-19 14:12:04 +00:00
collectAxioms feat: support #print axioms under the module system (#13117) 2026-03-27 10:15:49 +00:00
debug fix: lake: error on executables with duplicate root module names (#13028) 2026-03-23 18:10:10 +00:00
def_clash chore: improve how test suite interacts with stages (#12913) 2026-03-16 15:20:03 +00:00
deprecated_arg feat: add deprecated_arg attribute (#13011) 2026-03-30 10:20:44 +00:00
deriving chore: improve how test suite interacts with stages (#12913) 2026-03-16 15:20:03 +00:00
frontend chore: improve how test suite interacts with stages (#12913) 2026-03-16 15:20:03 +00:00
initialize chore: improve how test suite interacts with stages (#12913) 2026-03-16 15:20:03 +00:00
issue12825 fix: re-privatize constant name prefix in realizeConst to avoid diamond import collisions (#12964) 2026-03-18 13:54:50 +00:00
leanchecker refactor: remove Lean.Environment.replay from core (#12972) 2026-03-18 22:11:42 +00:00
linter_set chore: improve how test suite interacts with stages (#12913) 2026-03-16 15:20:03 +00:00
misc chore: improve how test suite interacts with stages (#12913) 2026-03-16 15:20:03 +00:00
mod_clash chore: improve how test suite interacts with stages (#12913) 2026-03-16 15:20:03 +00:00
module fix: namespace used in private import and current module vanishes dowstream (#12840) 2026-03-20 13:27:26 +00:00
path with spaces chore: improve how test suite interacts with stages (#12913) 2026-03-16 15:20:03 +00:00
prv chore: improve how test suite interacts with stages (#12913) 2026-03-16 15:20:03 +00:00
rebuild chore: improve how test suite interacts with stages (#12913) 2026-03-16 15:20:03 +00:00
setup chore: improve how test suite interacts with stages (#12913) 2026-03-16 15:20:03 +00:00
signal fix: use process signal numbers from correct architecture (#12900) 2026-03-17 13:33:13 +00:00
structure_docstrings chore: improve how test suite interacts with stages (#12913) 2026-03-16 15:20:03 +00:00
sym_ext feat: add extensible state mechanism for SymM (#13080) 2026-03-24 03:58:45 +00:00
sym_simp_attr feat: add Sym.simp theorem set attributes (#13018) 2026-03-21 03:53:39 +00:00
test_extern chore: improve how test suite interacts with stages (#12913) 2026-03-16 15:20:03 +00:00
user_attr chore: improve how test suite interacts with stages (#12913) 2026-03-16 15:20:03 +00:00
user_attr_app chore: improve how test suite interacts with stages (#12913) 2026-03-16 15:20:03 +00:00
user_ext chore: improve how test suite interacts with stages (#12913) 2026-03-16 15:20:03 +00:00
user_opt chore: improve how test suite interacts with stages (#12913) 2026-03-16 15:20:03 +00:00
user_plugin chore: improve how test suite interacts with stages (#12913) 2026-03-16 15:20:03 +00:00
ver_clash chore: clean up old test artifacts (#13179) 2026-03-30 08:02:52 +00:00
.gitignore chore: migrate pkg tests (#12889) 2026-03-11 18:55:46 +00:00