Skip to content

Incorrect pattern matching warnings (covering active patterns) #1281

@isaksky

Description

@isaksky

Pattern matching warnings seem to get confused by covering active patterns.

Repro steps

fsharp

Code:

    type Cond = Foo | Bar | Baz
    let (|SetV|) x _ = x

    [<EntryPoint>]
    let main argv = 
        let c = Cond.Foo

        match c with
        | Baz -> 
          printfn "Baz"
        | Foo & SetV "and" kwd
        | Bar & SetV "or" kwd ->
          printfn "Keyword: %s" kwd
        | Baz -> failwith "wat"

        0 // return an integer exit code

Expected behavior

Dropping the last case, it would compile with no warnings.

Actual behavior

It complains about a missing case, then even when you add it, it says it will never match.

Related information

Windows 10, Visual Studio 2015, power tools installed

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