aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dotty/tools/dotc/core/TypeApplications.scala12
-rw-r--r--src/dotty/tools/dotc/typer/Namer.scala2
2 files changed, 10 insertions, 4 deletions
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 `<rt>.this.$hk0, ..., <rt>.this.$hk<n-1>`. */
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]]
}
diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala
index 8437b651c..a8f3b8918 100644
--- a/src/dotty/tools/dotc/typer/Namer.scala
+++ b/src/dotty/tools/dotc/typer/Namer.scala
@@ -989,7 +989,7 @@ class Namer { typer: Typer =>
if (args.nonEmpty) {
val tycon = tp.withoutArgs(args)
val tycon1 = this(tycon)
- val tparams = tycon.typeParamSymbols
+ val tparams = tycon.typeParams
val args1 = if (args.length == tparams.length) etaExpandIfHK(tparams, args) else args
if ((tycon1 eq tycon) && (args1 eq args)) tp else tycon1.appliedTo(args1)
} else mapOver(tp)