blob: 47e2f0c599b3e42259f85467bea0006c970c532e (
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
|
object Tiark1 {
trait A { type L <: Nothing }
trait B { type L >: Any}
trait U {
val p: B
def brand(x: Any): p.L = x // error: not final
}
trait V extends U {
lazy val p: A & B = ???
}
val v = new V {}
v.brand("boom!")
}
object Tiark2 {
trait A { type L <: Nothing }
trait B { type L >: Any}
trait U {
type X <: B
val p: X
def brand(x: Any): p.L = x // error: not final
}
trait V extends U {
type X = B & A
lazy val p: X = ???
}
val v = new V {}
v.brand("boom!"): Nothing
}
|