Skip to content

Strict equality CanEqual derivation fails for classes in which type argument is not used for equality #14544

Closed
@SimY4

Description

@SimY4

Compiler version

Scala 3.1.1

Minimized code

import scala.language.strictEquality

case class MyClass[A](value: String)(val a: A) derives CanEqual

class Something {}

val a = MyClass[Something]("some")(new Something())
val b = MyClass[Something]("some")(new Something())

println(a == b)

Output

Values of types Playground.MyClass[Playground.Something] and Playground.MyClass[Playground.Something] cannot be compared with == or !=.
I found:

    Playground.MyClass.derived$CanEqual[Playground.Something, Playground.Something](
      /* missing */summon[CanEqual[Playground.Something, Playground.Something]]
    )

But no implicit values were found that match type CanEqual[Playground.Something, Playground.Something].

Expectation

Something is not part of case class universal equality check so it shouldn't be part of multiversal equality constraint either

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