|
| 1 | +// https://github.com/lampepfl/dotty/issues/12663 |
| 2 | + |
| 3 | +final class HookComponentBuilder[Ctx, CtxFn[_]] { |
| 4 | + def asd[A](f: Ctx => A): A = ??? |
| 5 | + def asd[A](f: CtxFn[A]): A = ??? |
| 6 | +} |
| 7 | + |
| 8 | +object HookCtx { |
| 9 | + case class P1[P, H1](props: P, hook1: H1) |
| 10 | +} |
| 11 | + |
| 12 | +object HookCtxFn { |
| 13 | + sealed trait P1[P, H1] { type Fn[A] = (P, H1) => A } |
| 14 | +} |
| 15 | + |
| 16 | +object Test { |
| 17 | + val b: HookComponentBuilder[ |
| 18 | + HookCtx.P1[String, Int], |
| 19 | + HookCtxFn.P1[String, Int]#Fn |
| 20 | + ] = ??? |
| 21 | + |
| 22 | + b.asd($ => $.props.length + $.hook1) |
| 23 | + b.asd((props, hook1) => props.length + hook1) |
| 24 | +} |
| 25 | + |
| 26 | +final class HookComponentBuilder2[Ctx, CtxFn[_]] { |
| 27 | + def asd[A](f: Ctx => A): A = ??? |
| 28 | + def asd[A](f: CtxFn[A]): A = ??? |
| 29 | +} |
| 30 | + |
| 31 | +object HookCtx2 { |
| 32 | + case class P1[P, H1](props: P, hook1: H1) |
| 33 | +} |
| 34 | + |
| 35 | +object HookCtxFn2 { |
| 36 | + type P1[P, H1] = [A] =>> (P, H1) => A |
| 37 | +} |
| 38 | + |
| 39 | +object Test2 { |
| 40 | + val b: HookComponentBuilder2[ |
| 41 | + HookCtx2.P1[String, Int], |
| 42 | + HookCtxFn2.P1[String, Int] |
| 43 | + ] = ??? |
| 44 | + |
| 45 | + b.asd($ => $.props.length + $.hook1) |
| 46 | + b.asd((props, hook1) => props.length + hook1) |
| 47 | +} |
| 48 | + |
| 49 | +final class Builder[CtxFn[_]] { |
| 50 | + def asd[A](f: Int => A): A = ??? |
| 51 | + def asd[A](f: CtxFn[A]): A = ??? |
| 52 | +} |
| 53 | + |
| 54 | +object Test3 { |
| 55 | + val b1: Builder[[Z] =>> (String, Int) => Z] = ??? |
| 56 | + b1.asd(identity) |
| 57 | + b1.asd(_.length + _) |
| 58 | + |
| 59 | + sealed trait Scala2TL { type F[Z] = (String, Int) => Z } |
| 60 | + val b2: Builder[Scala2TL#F] = b1 |
| 61 | + b2.asd(identity) |
| 62 | + b2.asd(_.length + _) |
| 63 | + |
| 64 | + type Scala3TL = [Z] =>> (String, Int) => Z |
| 65 | + val b3: Builder[Scala3TL] = b1 |
| 66 | + b3.asd(identity) |
| 67 | + b3.asd(_.length + _) |
| 68 | + |
| 69 | + val b4: Builder[({ type F[Z] = (String, Int) => Z })#F] = b1 |
| 70 | + b4.asd(identity) |
| 71 | + b4.asd(_.length + _) |
| 72 | +} |
0 commit comments