mirror of https://github.com/sbt/sbt.git
Merge pull request #2414 from smarter/fix/duplicate-defs
[0.13.10] ExtractAPI: avoid unnecessary duplication of defs with primitive types
This commit is contained in:
commit
e966329776
|
|
@ -107,8 +107,8 @@ abstract class Compat {
|
|||
}
|
||||
lazy val AnyValClass = global.rootMirror.getClassIfDefined("scala.AnyVal")
|
||||
|
||||
def isAnyValSubtype(sym: Symbol): Boolean = sym.isNonBottomSubClass(AnyValClass)
|
||||
|
||||
def isDerivedValueClass(sym: Symbol): Boolean =
|
||||
sym.isNonBottomSubClass(AnyValClass) && !definitions.ScalaValueClasses.contains(sym)
|
||||
}
|
||||
|
||||
object MacroExpansionOf {
|
||||
|
|
|
|||
|
|
@ -205,14 +205,14 @@ class ExtractAPI[GlobalType <: CallbackGlobal](val global: GlobalType,
|
|||
|
||||
val hasValueClassAsParameter: Boolean = {
|
||||
import MirrorHelper._
|
||||
s.asMethod.paramss.flatten map (_.info) exists (t => isAnyValSubtype(t.typeSymbol))
|
||||
s.asMethod.paramss.flatten map (_.info) exists (t => isDerivedValueClass(t.typeSymbol))
|
||||
}
|
||||
|
||||
def hasValueClassAsReturnType(tpe: Type): Boolean = tpe match {
|
||||
case PolyType(_, base) => hasValueClassAsReturnType(base)
|
||||
case MethodType(_, resultType) => hasValueClassAsReturnType(resultType)
|
||||
case Nullary(resultType) => hasValueClassAsReturnType(resultType)
|
||||
case resultType => isAnyValSubtype(resultType.typeSymbol)
|
||||
case resultType => isDerivedValueClass(resultType.typeSymbol)
|
||||
}
|
||||
|
||||
val inspectPostErasure = hasValueClassAsParameter || hasValueClassAsReturnType(viewer(in).memberInfo(s))
|
||||
|
|
|
|||
Loading…
Reference in New Issue