Skip to content

No kind inference for match types #10077

Closed
@IndiscriminateCoding

Description

@IndiscriminateCoding

Minimized code

trait T[F[_[_]]]
object T:
  type Inner[x] = x match { case T[f] => f }

trait Monad[F[_]]
type TMonad = T[Monad]

trait U[T0]:
  def f(x: T.Inner[T0]): Unit

class X extends U[T[Monad]]:
  /* it is impossible to give valid type for f */
  def f(x: T.Inner[T[Monad]]): Unit // Missing type parameter for Monad

Output

Missing type parameter for Monad

Expectation

I'm trying to use match types as a replacement for scala2 type projections, and it seems that it is not always possible now.
So I expect that it would be possible to define abstract method f as follows:

def f(x: T.Inner[T0][List]): Unit

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions