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 b2254f9
Browse filesBrowse the repository at this point in the historyBrowse files
Report shadowed polymorphic variant and aliased or-pattern payloads
Why:
A polymorphic variant payload equal to a literal case and the
alternatives of an or-pattern named with `as` got no warning, though
they can never match.
A polymorphic variant without payload stands for its name, or the number
its name spells, as in `Lambda.const_polyvar`, and an alias is looked
through when collecting or-pattern alternatives.
Diagnostic added (a shadowed polymorphic variant payload):
Example:
@unboxed type t = | @as("Foo") F | P([#Foo | #Bar])
let f = x => switch x { | F => 1 | P(#Foo) => 2 | P(_) => 3 }
Before (diagnostic): none
After (diagnostic):
Warning number 11
this match case is unused.
"Foo" is the runtime value of constructor F, so it is always matched as F, never as P.
Diagnostic added (an aliased or-pattern):
Example:
@unboxed type t = | @as("a") A | S(string)
let f = x => switch x { | S(("a" | "b") as s) => s | S(_) | A => "other" }
Before (diagnostic): none
After (diagnostic):
Warning number 12
this sub-pattern is unused.
"a" is the runtime value of constructor A, so it is always matched as A, never as S.
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>
0 commit comments