You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 44309a2
Browse filesBrowse the repository at this point in the historyBrowse files
Compare the @as tags of variant cases with payloads across signatures (#9009)
Why:
Interface inclusion compared the `@as` literal of nullary cases only. An
implementation could swap the tags of two cases with payloads, and its
clients then matched `M.A(_)` as `C` (#8956).
The tags of tagged cases with a payload are compared as those of nullary
cases are. An untagged case's `@as` does not change its representation and
is not compared. Type declarations in messages now print the `@as` of a
tagged case with a payload too, so the mismatch shows.
Diagnostic added:
Example:
module M: {
type t = A({x: int}) | C({x: int})
} = {
type t = | @as("C") A({x: int}) | @as("A") C({x: int})
}
After (diagnostic):
Type declarations do not match:
type t = @as("C") A({x: int}) | @as("A") C({x: int})
is not included in
type t = A({x: int}) | C({x: int})
The internal representations for case A are not equal.
Fixes: #8956
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>
- Reject an implementation whose variant cases with a payload have other `@as` tags than the interface states, and print those tags in type declarations.
0 commit comments