aboutsummaryrefslogtreecommitdiff
path: root/tests/neg/refinedSubtyping.scala
blob: dba489f3e7f2e4b2b887cdd772585e1f663f2fce (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
// tests that a refinement subtype satisfies all constraint
// of its refinemen supertype
class Test3 {

  trait A
  trait B

  class C { type T }

  type T1 = C { type T <: A }
  type T2 = T1 { type T <: B }

  type U1 = C { type T <: B }
  type U2 = C { type T <: A }

  var x: T2 = _
  val y1: U1 = ???
  val y2: U2 = ???

  x = y1 // error
  x = y2 // error

}