Skip to content

Commit

Permalink
Fix regression introduced in `Return older implementations without Fa…
Browse files Browse the repository at this point in the history
…talError`
  • Loading branch information
neko-kai committed May 29, 2021
1 parent dbba7d2 commit 4f9068d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ trait WithDISymbolInfo { this: DIUniverseBase with WithDISafeType =>
SymbolInfo.Static(
name = transformName(tpe.typeSymbol.name.toString),
finalResultType = tpe,
annotations = AnnotationTools.getAllTypeAnnotations[u.type](tpe),
annotations = AnnotationTools.getAllTypeAnnotations(u)(tpe),
isByName = tpe.typeSymbol.isClass && tpe.typeSymbol.asClass == u.definitions.ByNameParamClass,
wasGeneric = tpe.typeSymbol.isParameter,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
package izumi.fundamentals.reflection

import izumi.fundamentals.reflection.ReflectionUtil.stripByName

import scala.annotation.nowarn
import scala.reflect.api.Universe

object AnnotationTools {

def getAllAnnotations(u: Universe)(symb: u.Symbol): List[u.Annotation] = {
symb.annotations ++ getAllTypeAnnotations[u.type](symb.typeSignature)
symb.annotations ++ getAllTypeAnnotations(u)(symb.typeSignature)
}

def getAllTypeAnnotations[U <: Universe with Singleton](typ: U#Type): List[U#Annotation] = {
typ.finalResultType.dealias match {
case t: U#AnnotatedTypeApi =>
def getAllTypeAnnotations(u: Universe)(typ: u.Type): List[u.Annotation] = {
@nowarn("msg=outer reference")
val out = stripByName(u)(typ.finalResultType.dealias) match {
case t: u.AnnotatedTypeApi =>
t.annotations
case _ =>
Nil
}
out
}

def annotationTypeEq(u: Universe)(tpe: u.Type, ann: u.Annotation): Boolean = {
Expand Down

0 comments on commit 4f9068d

Please sign in to comment.