Skip to content

[bug] switching on optional field with type option results in totally weird warning #7954

@tx46

Description

@tx46
type t = {b?: option<int>}
let a: t = Obj.magic()


switch a {
  | {b: None} => ()
  | {b: Some(_)} => ()
}

gives warning:

[W] Line 5, column 0:

You forgot to handle a possible case here, for example: 
  | {b: None, _}

you could even add that particular case:

switch a {
  | {b: None, _} => ()
  | {b: Some(_)} => ()
}

and you'll still get the exact same warning

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions