- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.1k
Closed
Labels
backlogNo work planned on this by the core team for the time being.No work planned on this by the core team for the time being.itype:bug
Description
Compiler version
3.0.0
Minimized code (ver 1)
final class HookComponentBuilder[Ctx, CtxFn[_]] {
  def asd[A](f: Ctx => A): A = ???
  def asd[A](f: CtxFn[A]): A = ???
}
object HookCtx {
  case class P1[P, H1](props: P, hook1: H1)
}
object HookCtxFn {
  sealed trait P1[P, H1] { type Fn[A] = (P, H1) => A }
}
object Test {
  val b: HookComponentBuilder[HookCtx.P1[String, Int], HookCtxFn.P1[String, Int]#Fn] = ???
  b.asd($ => $.props.length + $.hook1)
  b.asd((props, hook1) => props.length + hook1)
}Minimized code (ver 2)
Changing HookCtxFn.P1 to a type lambda...
final class HookComponentBuilder[Ctx, CtxFn[_]] {
  def asd[A](f: Ctx => A): A = ???
  def asd[A](f: CtxFn[A]): A = ???
}
object HookCtx {
  case class P1[P, H1](props: P, hook1: H1)
}
object HookCtxFn {
  type P1[P, H1] = [A] =>> (P, H1) => A
}
object Test {
  val b: HookComponentBuilder[HookCtx.P1[String, Int], HookCtxFn.P1[String, Int]] = ???
  b.asd($ => $.props.length + $.hook1)
  b.asd((props, hook1) => props.length + hook1)
}Output
[error] 18 |  b.asd((props, hook1) => props.length + hook1)
[error]    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error]    |        Wrong number of parameters, expected: 1Expectation
It should compile. It does with Scala 2.13
Workaround
Inlining HookCtxFn.P1 makes it work.
final class HookComponentBuilder[Ctx, CtxFn[_]] {
  def asd[A](f: Ctx => A): A = ???
  def asd[A](f: CtxFn[A]): A = ???
}
object HookCtx {
  case class P1[P, H1](props: P, hook1: H1)
}
object Test {
  val b: HookComponentBuilder[HookCtx.P1[String, Int], [A] =>> (String, Int) => A] = ???
  b.asd($ => $.props.length + $.hook1)
  b.asd((props, hook1) => props.length + hook1)
}Metadata
Metadata
Assignees
Labels
backlogNo work planned on this by the core team for the time being.No work planned on this by the core team for the time being.itype:bug