Skip to content

wrong copy method with covariant type parameter #2382

Closed
@scabug

Description

@scabug
  case class U[+T](a: Int)(b: T => Int)

Note that no getter is generated for b, so there's no problem with b's type. The compiler will generate

  def copy[T1](a1: Int)(b1: T1 => Int) = {...}
  def copy$$default$$2: T => Int = b  // T in contravariant position
covariant type T occurs in contravariant position in type [T](a: Int)(T) => Int of method copy$$default$$2
       case class U[+T](a: Int)(b: T => Int)
                                ^

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions