Skip to content

Unification check in deriving is incorrect #13487

Closed
@sugakandrey

Description

@sugakandrey

Compiler version

3.0.1

Minimized code

trait TC[F[_, _[_]]]
object TC {
  def derived[F[_, _[_]]]: TC[F] = ???
}

case class Foo[A](a: A) derives TC

Output

Missing type parameter for _ in subpart Foo[_] of inferred type ([_, _[_$3]] =>> Foo[_])

Expectation

Foo cannot be unified with the type argument of TC as kinds of A and _[_] are different.
Note, that if we change TC to TC[_[_], _], we will now get Foo cannot be unified with the type argument of TC, even though it should compile. Perhaps https://github.com/lampepfl/dotty/blob/b7d2a122555a6aa44cc7590852a80f12512c535e/compiler/src/dotty/tools/dotc/typer/Deriving.scala#L163 was meant to use takeRight instead of take?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions