blob: 51ee0518733cb1bcfdc5c01edef1e8d086b96e14 (
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
32
33
34
35
|
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)
class C1 {
locally(bippy)
locally(self.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 dotty.runtime.LegacyApp {
val s1 = new Cake1 {}
assert((s1.x, s1.y) == (1, 2), (s1.x, s1.y))
}
|