diff options
Diffstat (limited to 'test/files/run/macro-sip19')
-rw-r--r-- | test/files/run/macro-sip19/Impls_Macros_1.scala | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/test/files/run/macro-sip19/Impls_Macros_1.scala b/test/files/run/macro-sip19/Impls_Macros_1.scala index 535ec2ccf0..f66ab71479 100644 --- a/test/files/run/macro-sip19/Impls_Macros_1.scala +++ b/test/files/run/macro-sip19/Impls_Macros_1.scala @@ -1,13 +1,14 @@ -import scala.reflect.macros.Context +import scala.reflect.macros.whitebox.Context object Macros { def impl(c: Context) = { import c.universe._ - val Apply(fun, args) = c.enclosingImplicits(0)._2 + val Apply(fun, args) = c.enclosingImplicits(0).tree val fileName = fun.pos.source.file.file.getName val line = fun.pos.line val charOffset = fun.pos.point - c.universe.reify { SourceLocation(c.literal(fileName).splice, c.literal(line).splice, c.literal(charOffset).splice) } + def literal[T](x: T) = c.Expr[T](Literal(Constant(x))) + c.universe.reify { SourceLocation(literal(fileName).splice, literal(line).splice, literal(charOffset).splice) } } implicit def sourceLocation: SourceLocation = macro impl |