mirror of https://github.com/sbt/sbt.git
Restore source compatibility with Scala 2.8
This commit is contained in:
parent
bfc27f1179
commit
f5e7fdd62a
|
|
@ -183,16 +183,26 @@ class ExtractAPI[GlobalType <: CallbackGlobal](val global: GlobalType,
|
||||||
{
|
{
|
||||||
import MirrorHelper._
|
import MirrorHelper._
|
||||||
|
|
||||||
// Here we must be careful to also consider the type parameters, because a tuple (Foo, Int)
|
val hasValueClassAsParameter: Boolean = {
|
||||||
// may become (Int, Int) for instance.
|
import MirrorHelper._
|
||||||
def hasValueClassAsParameter(meth: MethodSymbol): Boolean =
|
s.asMethod.paramss.flatten map (_.info) exists (t => isAnyValSubtype(t.typeSymbol))
|
||||||
meth.paramss.flatten map (_.info) exists (t => isAnyValSubtype(t.typeSymbol))
|
}
|
||||||
|
|
||||||
// Here too we must care for the type parameters (see above comment).
|
// Note: We only inspect the "outermost type" (i.e. no recursion) because we don't need to
|
||||||
def hasValueClassAsReturnType(meth: MethodSymbol): Boolean =
|
// inspect after erasure a function that would, for instance, return a function that returns
|
||||||
isAnyValSubtype(meth.returnType.typeSymbol)
|
// a subtype of AnyVal.
|
||||||
|
val hasValueClassAsReturnType: Boolean = {
|
||||||
|
val tpe = viewer(in).memberInfo(s)
|
||||||
|
tpe match {
|
||||||
|
case PolyType(_, base) => isAnyValSubtype(base.typeSymbol)
|
||||||
|
case MethodType(_, resultType) => isAnyValSubtype(resultType.typeSymbol)
|
||||||
|
case Nullary(resultType) => isAnyValSubtype(resultType.typeSymbol)
|
||||||
|
case resultType => isAnyValSubtype(resultType.typeSymbol)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val inspectPostErasure = hasValueClassAsParameter || hasValueClassAsReturnType
|
||||||
|
|
||||||
val inspectPostErasure = hasValueClassAsParameter(s.asMethod) || hasValueClassAsReturnType(s.asMethod)
|
|
||||||
def build(t: Type, typeParams: Array[xsbti.api.TypeParameter], valueParameters: List[xsbti.api.ParameterList]): List[xsbti.api.Def] =
|
def build(t: Type, typeParams: Array[xsbti.api.TypeParameter], valueParameters: List[xsbti.api.ParameterList]): List[xsbti.api.Def] =
|
||||||
{
|
{
|
||||||
def parameterList(syms: List[Symbol]): xsbti.api.ParameterList =
|
def parameterList(syms: List[Symbol]): xsbti.api.ParameterList =
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue