Skip to content

generated canEqual is wrong in value classes #9288

Open
@scabug

Description

for a value class

case class tst(a: Int) extends AnyVal

from decompiler i get:

public final boolean equals$extension(int $this, Object x$1) {
      int n;
      Object object = x$1;
      boolean bl = object instanceof tst;
      return bl && $this == (n = ((tst)x$1).u())
  }

public final boolean canEqual$extension(int $this, Object x$1) {
      return x$1 instanceof java.lang.Integer;
    }

The second is wrong.

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