Skip to content

MissingWhenCase false negative with nulls #3189

@BraisGabin

Description

@BraisGabin

Expected Behavior

MissingWhenCase should check for null case if the enum or sealed can be null

Observed Behavior

It doesn't check that.

Steps to Reproduce

fun whenOnEnumPass(c: Color?) {
    when(c) {
        Color.BLUE -> {}
        Color.GREEN -> {}
        Color.RED -> {}
    }
}

Your Environment

  • Version of detekt used: master (1.14.2)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions