blob: 2993218bb4b53cb994495d0968cab03b869c1f07 (
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
36
37
38
39
40
41
42
43
44
45
46
47
48
|
import scala.reflect.macros.blackbox.Context
object B { override def toString = "object" }
class C { override def toString = "class" }
package foo {
object B { override def toString = "package > object" }
class C { override def toString = "package > class" }
}
object foo {
object B { override def toString = "object > object" }
class C { override def toString = "object > class" }
}
object packageless {
def impl(c: Context) = {
import c.universe._
reify {
println(B)
println(new C)
println(foo.B)
println(new foo.C)
println(_root_.foo.B)
println(new _root_.foo.C)
}
}
def test = macro impl
}
package packageful {
object Test {
def impl(c: Context) = {
import c.universe._
reify {
println(B)
println(new C)
println(foo.B)
println(new foo.C)
println(_root_.foo.B)
println(new _root_.foo.C)
}
}
def test = macro impl
}
}
|