Repository navigation
Keep @deprecated on let bindings in inferred signatures - #8924
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #8924 +/- ##
=======================================
Coverage 81.11% 81.12%
=======================================
Files 455 455
Lines 63672 63682 +10
=======================================
+ Hits 51650 51660 +10
Misses 12022 12022
🚀 New features to boost your workflow:
|
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>
b9e404c to
b92b5e3
Compare
With deprecated `let` bindings now reaching other modules, the existing
`@deprecated` on `Pervasives.failwith` and `Pervasives.invalid_arg` warns
at every use. The message now names the replacements. The rewatch test
repository throws `Failure` directly, so the suite's build output stays free
of the warning.
Diagnostic (text):
Warning number 3
deprecated: Pervasives.failwith
Use a custom exception or `JsError.throwWithMessage` instead.
Review: The message has no `migrate` template, because both replacements
throw a different exception than `Failure` / `Invalid_argument`.
Review: tests/tests, belt_tests and the reanalyze tests still call
`failwith` and `invalid_arg`; their configurations disable warning 3, so
they stay unchanged.
Area: runtime tests
Output: changed rewatch/testrepo FileToTest_test.mjs, which throws `Failure`
inline instead of calling `Pervasives.failwith`
Tests: ~rewatch/testrepo/packages/with-dev-deps/test/FileToTest_test.res
~rewatch/testrepo/packages/with-dev-deps/test/FileToTest_test.mjs
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>
rescript
@rescript/belt
@rescript/darwin-arm64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
|
Developer playground preview: https://rescript-lang.github.io/rescript/dev-playground/?version=pr-8924 |
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
A module without an interface file gets its signature from the implementation, and
let-bound values went into it without their attributes. So a@deprecatedletnever warned in other modules, while@deprecatedexternals, types and modules did. Each let-bound value's signature item now keeps the binding's@deprecatedattributes, and only those. Uses inside the defining structure still do not warn.Fixes #5335.
New test:
tests/build_tests/super_errors_multi/fixtures/Cross_deprecated_res_itemsuses a deprecatedlet, external, module and type from another module and expects exactly one warning for each.Not in this PR: a deprecated item used as an operand of
+or another unified operator warns twice, becausetranslate_unified_opstypes that operand twice.🤖 Generated with Claude Code
https://claude.ai/code/session_01Kr4cjoUi2f5VpMvE6wT9bo