Skip to content

Commit 0360ab4

Browse files
committed
Update reflect annottations API
1 parent bdf4e44 commit 0360ab4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

modules/deriving/src/main/scala/shapeless3/deriving/annotation.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ object AnnotationMacros {
133133
'{???}
134134
} else {
135135
val annoteeTpe = TypeRepr.of[T]
136-
annoteeTpe.typeSymbol.annots.find(_.tpe <:< annotTpe) match {
136+
// TODO try to use `getAnnotation` for performance
137+
annoteeTpe.typeSymbol.annotations.find(_.tpe <:< annotTpe) match {
137138
case Some(tree) => '{ Annotation.mkAnnotation[A, T](${tree.asExprOf[A]}) }
138139
case None =>
139140
report.error(s"No Annotation of type ${annotTpe.show} for type ${annoteeTpe.show}")
@@ -159,7 +160,8 @@ object AnnotationMacros {
159160
}
160161

161162
def findAnnotation[A: Type](annoteeSym: Symbol): Expr[Option[A]] =
162-
annoteeSym.annots.find(_.tpe <:< TypeRepr.of[A]) match {
163+
// TODO try to use `getAnnotation` for performance
164+
annoteeSym.annotations.find(_.tpe <:< TypeRepr.of[A]) match {
163165
case Some(tree) => '{ Some(${tree.asExprOf[A]}) }
164166
case None => '{ None }
165167
}

0 commit comments

Comments
 (0)