Skip to content

Using type alias with dependent type produces error. Manual inlining makes the error go away. #12655

Closed
@marcinzh

Description

@marcinzh

Compiler version

3.0.0

Minimized code

trait Signature:
  type Impl[A, U]

type Operation[Z <: Signature, A, U] = (z: Z) => z.Impl[A, U]

// This produces error:
case class Perform[Z <: Signature, A, U](op: Operation[Z, A, U])

// However, if I manually inline the type alias, the error goes away:
case class Perform_fix[Z <: Signature, A, U](op: (z: Z) => z.Impl[A, U])

// Also, using the alias in other contexts does not produce errors:
def foo[Z <: Signature, A, U](op: Operation[Z, A, U]): Unit = ???

Above snippet in Scastie: https://scastie.scala-lang.org/h8VPuvAMS72F42Cb11RubA

Output

Found:    (Perform.this.op : Operation[Z, A, U])
Required: Operation[<? <: Signature>, <?>, <?>]

Expectation

Not having to manually inline the type alias.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions