Skip to content

Pattern DUCase matches DUCase _ #9520

@charlesroddie

Description

@charlesroddie
type DU = | DUCase of int
let y =
    function
    | DUCase -> () // This should fail with FS0019: This constructor is applied to 0 argument(s) but expects 1

This type-checks in VS tooling and works in F# interactive. Behaviour is as if the user had written the correct | DUCase _ -> ()

This doesn't apply to active patterns, which fail without arguments as expected.

Tested on VS 2019 16.6.0 and "F# Interactive version 10.9.1.0 for F# 4.7".

SharpLab doesn't have the problem and gives expected error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions