Repository navigation
Commit b92b5e3
Keep @deprecated on let bindings in inferred signatures
A module without an interface file gets its signature from its
implementation. Values bound by `let` entered that signature without
their attributes, so `@deprecated` on a `let` had no effect on other
modules, while `@deprecated` externals, types and modules warned. The
signature item of each let-bound value now carries the binding's
`@deprecated` attributes. Uses inside the defining structure still do
not warn; uses from other modules, and from outside a submodule, do.
Example (rescript):
// Legacy.res
@deprecated("Use newF instead")
let oldF = x => x + 1
// User.res
let a = Legacy.oldF(1)
Diagnostic (text):
Warning number 3
User.res:1:9-19
deprecated: Legacy.oldF
Use newF instead
Review: Only the `deprecated` attributes are copied, so docstrings and
other binding attributes stay out of the `.cmi` and gentype, analysis and
reanalyze see the same value descriptions as before.
Review: An implementation with `@deprecated let x` checked against an
interface whose `let x` lacks it now gets warning 3 ("deprecated: x"),
as `@deprecated` externals, types and modules already do.
Review: The issue's duplicate warnings come from `translate_unified_ops`
typing an operand of `+` and the other unified operators twice; any
warning inside that operand repeats. This change leaves that alone.
Area: typechecker tests
Output: unchanged
Formatting: unchanged
Formats: none
PPX: unchanged
Editor: unchanged in the analysis fixtures; values the analysis reads
from a module type (`Sig_value`, e.g. through `include`) can now show
as deprecated
Tests: +tests/build_tests/super_errors_multi/fixtures/Cross_deprecated_res_items
+tests/build_tests/super_errors_multi/expected/Cross_deprecated_res_items.expected
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kr4cjoUi2f5VpMvE6wT9bo
Signed-off-by: Christoph Knittel <ck@cca.io>1 parent b7c67d2 commit b92b5e3
7 files changed
Lines changed: 96 additions & 1 deletion
File tree
- changes
- compiler/ml
- tests/build_tests/super_errors_multi
- expected
- fixtures/Cross_deprecated_res_items
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
65 | 68 | | |
66 | 69 | | |
67 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
43 | 47 | | |
44 | 48 | | |
45 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1398 | 1398 | | |
1399 | 1399 | | |
1400 | 1400 | | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
1401 | 1413 | | |
1402 | 1414 | | |
1403 | 1415 | | |
1404 | 1416 | | |
1405 | | - | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
1406 | 1428 | | |
1407 | 1429 | | |
1408 | 1430 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
0 commit comments