Skip to content

"Pattern match on value" code action produces unnecessary patterns on discard #5939

Description

@GearsDatapacks

Given some code like this:

pub type Wibble {
  Wibble
  Wobble
  Wubble
}

pub fn go(w: Wibble) {
  case w {
    Wibble -> 1
    _ -> 2
  //^ Trigger "Pattern match on value" code action
  }
}

This becomes:

pub type Wibble {
  Wibble
  Wobble
  Wubble
}

pub fn main(w: Wibble) {
  case w {
    Wibble -> 1
    Wibble -> 2
    Wobble -> 2
    Wubble -> 2
  }
}

It fills in the Wibble pattern, even though that's already matched on above. Would be nice if it could detect that and only add Wobble and Wubble here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedContributions encouraged

    Fields

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions