aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/TypeApplications.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-06-02 18:59:42 +0200
committerMartin Odersky <odersky@gmail.com>2016-07-11 13:35:00 +0200
commita7d61c0ffc99c52109937c899c789ad9ea5d6a5b (patch)
tree9f66a72a4852dd3031a8136bb061d16a0f204336 /src/dotty/tools/dotc/core/TypeApplications.scala
parente61b80ae4db8d2fdd7ed43a834f0de86d1edda15 (diff)
downloaddotty-a7d61c0ffc99c52109937c899c789ad9ea5d6a5b.tar.gz
dotty-a7d61c0ffc99c52109937c899c789ad9ea5d6a5b.tar.bz2
dotty-a7d61c0ffc99c52109937c899c789ad9ea5d6a5b.zip
Make etaExpandIfHk work for non-symbol type params
Fixes a crasher in t2994.scala
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeApplications.scala')
-rw-r--r--src/dotty/tools/dotc/core/TypeApplications.scala12
1 files changed, 9 insertions, 3 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]]
}