File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
main/scala-2/com/github/dwickern/macros
test/scalajvm/com/github/dwickern/macros Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 11package com .github .dwickern .macros
22
33import scala .language .experimental .macros
4- import scala .reflect .macros .{ blackbox , whitebox }
4+ import scala .reflect .macros .whitebox
55import scala .annotation .tailrec
66
77object NameOfImpl {
@@ -47,7 +47,7 @@ object NameOfImpl {
4747 c.Expr [String ](q " $name" )
4848 }
4949
50- def qualifiedNameOf (c : blackbox .Context )(expr : c.Expr [Any ]): c.Expr [String ] = {
50+ def qualifiedNameOf (c : whitebox .Context )(expr : c.Expr [Any ]): c.Expr [String ] = {
5151 import c .universe ._
5252
5353 def extractNames (tree : c.Tree ): List [c.Name ] = {
Original file line number Diff line number Diff line change @@ -35,6 +35,18 @@ class AnnotationTest extends AnyFunSuite with Matchers {
3535 annotation.name should === (" classMember" )
3636 }
3737
38+ test(" qualifiedNameOf" ) {
39+ class C (val foo : Foo )
40+ class Foo (val bar : Bar )
41+ class Bar (val baz : String )
42+
43+ @ Resource (name = qualifiedNameOf[C ](_.foo.bar.baz))
44+ class AnnotatedClass
45+
46+ val annotation = classOf [AnnotatedClass ].getDeclaredAnnotation(classOf [Resource ])
47+ annotation.name should === (" foo.bar.baz" )
48+ }
49+
3850 test(" nameOfType" ) {
3951 @ Resource (name = nameOfType[AnnotatedClass ])
4052 class AnnotatedClass
You can’t perform that action at this time.
0 commit comments