Skip to content

Change OptionalUnit to report Unit returned by method implementations in interfaces #3099

@3flex

Description

@3flex

Expected Behavior of the rule

This gets flagged by OptionalUnit:

interface Foo {
  fun onMapClicked(point: Point?) = Unit
}

Right now though that use of Unit isn't reported.

Context

This could instead be written as:

interface Foo {
  fun onMapClicked(point: Point?) {}
}

The use of Unit in the first example is therefore optional and should be reported. This means reverting the logic introduced in #1176.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions