Repository navigation
[12.x] Deprecate @unboxed on a variant constructor - #9049
Conversation
Why:
v13 rejects @unboxed on a constructor (#9040): @unboxed applies to a
whole variant. 12.x users should hear about it before upgrading.
`@unboxed` written on a constructor warns (warning 3), before the type's
attributes are copied to its constructors, so a type-level `@unboxed` does
not warn.
Diagnostic added (@unboxed on a constructor):
Example:
type mixed = | @unboxed Text(string) | Count(int)
@unboxed
type whole = | @unboxed Name(string) | Age(int)
Before (diagnostic): none
After (diagnostic):
Warning number 3
deprecated: @unboxed on constructor Text is deprecated and will be an
error in v13, where @unboxed applies to a whole variant: write it on the
type, as in `@unboxed type t = ...`.
Warning number 3
deprecated: @unboxed on constructor Name is deprecated and will be an
error in v13. The type is already @unboxed, so remove it from the
constructor.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CMkrYaktctdKc4M41WF36t
Signed-off-by: Christoph Knittel <ck@cca.io>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CMkrYaktctdKc4M41WF36t Signed-off-by: Christoph Knittel <ck@cca.io>
|
@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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7e73b906af
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
Why:
A variant spread copies the source constructors with their attributes,
including the source type's `@unboxed`, so the spread site warned about
an annotation the user never wrote, or repeated the source's warning.
The deprecation now skips constructors marked as coming from a spread;
`@unboxed` written on a constructor is reported once, where it is written.
Diagnostic removed (@unboxed reported at a spread):
Example:
@unboxed
type a = A(string)
@unboxed
type b = | ...a | B(int)
Before (diagnostic):
Warning number 3
1:1-8
deprecated: @unboxed on constructor A is deprecated and will be an
error in v13. The type is already @unboxed, so remove it from the
constructor.
After (diagnostic): none
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CMkrYaktctdKc4M41WF36t
Signed-off-by: Christoph Knittel <ck@cca.io>
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! 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". |
v13 rejects
@unboxedon a variant constructor (#9040):@unboxedapplies to a whole variant. This deprecates it in 12.x so users hear about it before upgrading.@unboxedwritten on a constructor now gives warning 3, with one of two messages:@unboxed: "@unboxed on constructor Text is deprecated and will be an error in v13, where @unboxed applies to a whole variant: write it on the type, as in@unboxed type t = ...."@unboxedtype: "… The type is already @unboxed, so remove it from the constructor."The check reads the constructor's attributes as written, before the type's attributes are copied to its constructors, so a type-level
@unboxeddoes not warn. A@warning("-3")on the constructor silences it.New test:
super_errors/fixtures/unboxed_on_constructor_deprecated.res.🤖 Generated with Claude Code
https://claude.ai/code/session_01CMkrYaktctdKc4M41WF36t