Skip to content

Incorrect pattern matching exhaustiveness warning when using :: and the & operators #3294

@mrakgr

Description

@mrakgr
let f = function
    | [] -> 0
    | (_ :: _) & _ -> 0

Script1.fsx(1,9): warning FS0025: Incomplete pattern matches on this expression. For example, the value '[]' may indicate a case not covered by the pattern(s).

In VS2015 this gives me the above warning. As would be expected running the above with [] returns 0. It also gives the same warning when the last case is written out as _ :: (_ :: _). When & is replaced by as in the above code fragment the warning disappears.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Compiler-PatternMatchingpattern compilation, active patterns, performance, codegenBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions