Skip to content

Enumeration should derive CanEqual #13722

Open
@soronpo

Description

@soronpo

When using an enumeration, we expect pattern matching on the objects to work by default even under strictEquality.

Compiler version

v3.1.0-RC1

Minimized code

import scala.language.strictEquality
enum FooBar:
  case Foo, Bar

def check(fb : FooBar): Unit =
  fb match
    case FooBar.Foo =>
    case FooBar.Bar =>

Output

Values of types FooBar and FooBar cannot be compared with == or !=
Values of types FooBar and FooBar cannot be compared with == or !=

Expectation

No error.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions