Skip to content
Permalink
Browse files

Use fully-qualified classOf from scala.Predef

  • Loading branch information
liff authored and sarahgerweck committed Nov 26, 2019
1 parent 5deaa53 commit 845c14fc93fc06fd84a6a25899d4d57f47dd66ae
@@ -62,7 +62,7 @@ private[log4s] object LoggerMacros {
val typeParams = typeSymbol.typeParams

if (typeParams.isEmpty) {
loggerByParam(q"classOf[$typeSymbol]")
loggerByParam(q"_root_.scala.Predef.classOf[$typeSymbol]")
} else {
if (typeParams.exists(_.asType.typeParams.nonEmpty)) {
/* We have at least one higher-kinded type: fall back to by-name logger construction, as
@@ -71,7 +71,7 @@ private[log4s] object LoggerMacros {
} else {
val typeArgs = List.fill(typeParams.length)(WildcardType)
val typeConstructor = tq"$typeSymbol[..${typeArgs}]"
loggerByParam(q"classOf[$typeConstructor]")
loggerByParam(q"_root_.scala.Predef.classOf[$typeConstructor]")
}
}
}
@@ -115,6 +115,11 @@ class GetLoggerSpec extends FlatSpec with Matchers with GivenWhenThen with Logge
val hkt = new GetLoggerSpecKinds.NestedKind1[Seq]
hkt.logger.name shouldEqual "org.log4s.GetLoggerSpecKinds.NestedKind1"
}

it should "use classOf from scala.Predef" in {
val classOf = 1 // shadow the symbol to make compilation fail if it’s attempted to be used
getLogger.name shouldEqual "org.log4s.GetLoggerSpec"
}
}

private class GetLoggerSpecParam[A] {

0 comments on commit 845c14f

Please sign in to comment.
You can’t perform that action at this time.