aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/TypeApplications.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-12-02 15:42:56 +0100
committerMartin Odersky <odersky@gmail.com>2015-12-06 16:09:21 +0100
commit2abcd02d2a2067ba78430262664f5d3ab9b61d00 (patch)
tree4b9682b86fd860b8ca65aa88b0e14f41dfc7c7df /src/dotty/tools/dotc/core/TypeApplications.scala
parent67d28339d91f912c2894a05110d713f077458feb (diff)
downloaddotty-2abcd02d2a2067ba78430262664f5d3ab9b61d00.tar.gz
dotty-2abcd02d2a2067ba78430262664f5d3ab9b61d00.tar.bz2
dotty-2abcd02d2a2067ba78430262664f5d3ab9b61d00.zip
Use new adaptArgs for Scala2Unpickler
Also: fix adaptArgs and LambdaTrait to make it work.
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeApplications.scala')
-rw-r--r--src/dotty/tools/dotc/core/TypeApplications.scala22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/dotty/tools/dotc/core/TypeApplications.scala b/src/dotty/tools/dotc/core/TypeApplications.scala
index 0cf40d818..b1ffe0169 100644
--- a/src/dotty/tools/dotc/core/TypeApplications.scala
+++ b/src/dotty/tools/dotc/core/TypeApplications.scala
@@ -169,7 +169,8 @@ object TypeApplications {
/** Adapt all arguments to possible higher-kinded type parameters using adaptIfHK
*/
def adaptArgs(tparams: List[Symbol], args: List[Type])(implicit ctx: Context): List[Type] =
- args.zipWithConserve(tparams)((arg, tparam) => arg.adaptIfHK(tparam.infoOrCompleter))
+ if (tparams.isEmpty) args
+ else args.zipWithConserve(tparams)((arg, tparam) => arg.adaptIfHK(tparam.infoOrCompleter))
def argRefs(rt: RefinedType, n: Int)(implicit ctx: Context) =
List.range(0, n).map(i => RefinedThis(rt).select(tpnme.hkArg(i)))
@@ -234,18 +235,13 @@ class TypeApplications(val self: Type) extends AnyVal {
final def paramBounds(implicit ctx: Context): List[TypeBounds] =
typeParams.map(self.memberInfo(_).bounds)
- def LambdaTrait(implicit ctx: Context) = {
- def skipArgs(tp: Type): Type = tp match {
- case RefinedType(parent, pname) if pname.isHkArgName => skipArgs(parent)
- case _ => tp
- }
- self.stripTypeVar match {
- case RefinedType(parent, tpnme.hkApply) => skipArgs(parent).stripTypeVar match {
- case ref @ TypeRef(_, lam) if lam.isLambdaTraitName => ref.symbol
- case _ => NoSymbol
- }
- case _ => NoSymbol
- }
+ /** The Lambda trait underlying a type lambda */
+ def LambdaTrait(implicit ctx: Context): Symbol = self.stripTypeVar match {
+ case RefinedType(parent, tpnme.hkApply) =>
+ val sym = self.classSymbol
+ if (sym.isLambdaTrait) sym else NoSymbol
+ case TypeBounds(lo, hi) => hi.LambdaTrait
+ case _ => NoSymbol
}
def isEtaExpandable(implicit ctx: Context) = self match {