blob: 6c1959ddacbdb94c3e37462d80c0ae9b295bb17d (
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
31
|
trait Cake extends Slice
// Minimization
trait Slice { self: Cake => // must have self type that extends `Slice`
private[this] val bippy = () // must be private[this]
locally(bippy)
}
// Originally reported bug:
trait Cake1 extends Slice1
trait Slice1 { self: Cake1 =>
import java.lang.String // any import will do!
val Tuple2(x, y) = ((1, 2))
}
// Nesting
trait Cake3 extends Outer.Slice3
// Minimization
object Outer {
private[this] val bippy = ()
trait Slice3 { self: Cake3 =>
locally(bippy)
}
}
object Test extends App {
val s1 = new Cake1 {}
assert((s1.x, s1.y) == (1, 2), (s1.x, s1.y))
}
|