aboutsummaryrefslogtreecommitdiff
path: root/tests/pos/t2712-2.scala
blob: 95172545d4c7419cd89e0c520005b5e4af44e06c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package test

// See: https://github.com/milessabin/si2712fix-demo/issues/3
object Test {
  trait A[T1, T2] { }
  trait B[T1, T2] { }
  class C[T] extends A[T, Long] with B[T, Double]
  class CB extends A[Boolean, Long] with B[Boolean, Double]

  trait A2[T]
  trait B2[T]
  class C2[T] extends A2[T] with B2[T]
  class CB2 extends A2[Boolean] with B2[Boolean]

  def meh[M[_], A](x: M[A]): M[A] = x

  val m0 = meh(new C[Boolean])
  m0: C[Boolean]
  val m1 = meh(new CB)
  m1: B[Boolean, Double] // note: different order in which parents are visited for hk type inference. Dotty picks libearization order.
  val m2 = meh(new C2[Boolean])
  m2: C2[Boolean]
  val m3 = meh(new CB2)
  m3: B2[Boolean] // note: different order in which parents are visited for hk type inference. Dotty picks libearization order.
}