Pattern discard allowed for union case that takes no data
See original GitHub issueMatch discards aren’t type checked against case
type X = X
let test() =
match X with
| X _ -> () // No error X doesn't have arguments
Issue Analytics
- State:
- Created a year ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
See it, Say it, Sort it! - - DevConflicts
I got a lot of feedback and suggestions, and I ended up with Pattern discard is not allowed for union case that takes...
Read more >Pattern Matching - F# | Microsoft Learn
Discriminated union patterns can be simple named cases or they can have a value, or a tuple containing multiple values. If there is...
Read more >rust - Why does pattern matching on a union have an ...
1 Answer. The entire point of a union is that the compiler doesn't store any information in the union about what type it...
Read more >Typed Union Cases · Issue #606 · fsharp/fslang-suggestions
As it stands today, Union Cases have corresponding Types generated by the compiler if at lease one Case of the Union contains data,...
Read more >OCaml for the Skeptical: Pattern Matching
Pattern matching comes up in several places in OCaml: as a powerful control structure combining a multi-armed conditional, unification, data destructuring ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Things have changed a bit since 2016, and we now are more inclined to emit new informationals and warnings, protected by a
/langversion
switch.So I’d definitely be ok with emitting at least an informational, and possibly a warning for this case.
Agree, I think it should be a warning behind language version. It should also be easy to add a quick fix to VS (and other IDEs) which will be removing unnecessary discards.