From a7d61c0ffc99c52109937c899c789ad9ea5d6a5b Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Thu, 2 Jun 2016 18:59:42 +0200 Subject: Make etaExpandIfHk work for non-symbol type params Fixes a crasher in t2994.scala --- src/dotty/tools/dotc/core/TypeApplications.scala | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/dotty/tools/dotc/core/TypeApplications.scala') diff --git a/src/dotty/tools/dotc/core/TypeApplications.scala b/src/dotty/tools/dotc/core/TypeApplications.scala index dfd1caf62..c270288b2 100644 --- a/src/dotty/tools/dotc/core/TypeApplications.scala +++ b/src/dotty/tools/dotc/core/TypeApplications.scala @@ -236,9 +236,15 @@ object TypeApplications { /** Adapt all arguments to possible higher-kinded type parameters using etaExpandIfHK */ - def etaExpandIfHK(tparams: List[Symbol], args: List[Type])(implicit ctx: Context): List[Type] = + def etaExpandIfHK(tparams: List[MemberBinding], args: List[Type])(implicit ctx: Context): List[Type] = if (tparams.isEmpty) args - else args.zipWithConserve(tparams)((arg, tparam) => arg.etaExpandIfHK(tparam.infoOrCompleter)) + else { + def bounds(tparam: MemberBinding) = tparam match { + case tparam: Symbol => tparam.infoOrCompleter + case tparam: RefinedType => tparam.memberBounds + } + args.zipWithConserve(tparams)((arg, tparam) => arg.etaExpandIfHK(bounds(tparam))) + } /** The references `.this.$hk0, ..., .this.$hk`. */ def argRefs(rt: RefinedType, n: Int)(implicit ctx: Context) = @@ -374,7 +380,7 @@ class TypeApplications(val self: Type) extends AnyVal { final def typeParamSymbols(implicit ctx: Context): List[TypeSymbol] = { val tparams = typeParams - assert(tparams.isEmpty || tparams.head.isInstanceOf[Symbol]) + assert(tparams.isEmpty || tparams.head.isInstanceOf[Symbol], self) tparams.asInstanceOf[List[TypeSymbol]] } -- cgit v1.2.3