-
Notifications
You must be signed in to change notification settings - Fork 824
Open
Labels
Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingType checking, attributes and all aspects of logic checkingArea-Compiler-PatternMatchingpattern compilation, active patterns, performance, codegenpattern compilation, active patterns, performance, codegenFeature Request
Milestone
Description
Is your feature request related to a problem? Please describe.
type Foo =
inherit IDisposable
let blah () =
([] : Foo list)
|> Seq.iter (function | :? IDisposable as x -> ())
This fails with a rather amusing combination of two errors:
- At
function
: Incomplete pattern matches on this expression. For example, the value 'some-other-subtype
' may indicate a case not covered by the pattern(s). - At
:? IDisposable
: This type test or downcast will always hold.
The error messages are telling me that the match is incomplete and complete at the same time!
Describe the solution you'd like
Accept the definition. It's presumably semantically equivalent to:
let blah () =
([] : Foo list)
|> Seq.iter (fun (x : IDisposable) -> ())
Describe alternatives you've considered
Just don't do this. Users can always do an explicit type annotation, and the code is even shorter! The failure mode just amused me.
This is super low priority, of course.
Metadata
Metadata
Assignees
Labels
Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingType checking, attributes and all aspects of logic checkingArea-Compiler-PatternMatchingpattern compilation, active patterns, performance, codegenpattern compilation, active patterns, performance, codegenFeature Request
Type
Projects
Status
New