aboutsummaryrefslogtreecommitdiff
path: root/tests/patmat/i2253.scala
blob: 0344a6a5d2f1dd1391becf4e9b9ac6c156ba8b61 (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
26
27
28
29
30
sealed trait S

object BodylessObject extends S

object HasIntM extends S {
  type M = Int
}

object HasStringXStringM extends S {
  type M = String
  val x: String = ""
}

object HasIntXStringM extends S {
  type M = String
  val x: Int = 0
}

object HasIntXIntM extends S {
  type M = Int
  val x: Int = 0
}

trait T

class Test {
  def onlyIntX(s: S { val x: Int }) = s match { case _: T => ; }
  def exposeAlias1[I <: Int](s: S { type M = I; val x: Int }) = s match { case _: T => ; }
  def exposeAlias2[I <: Int](s: S { val x: Int; type M = I }) = s match { case _: T => ; }
}