aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-07-14 19:53:05 +0200
committerMartin Odersky <odersky@gmail.com>2015-09-18 18:05:15 +0200
commit5f7eadf3f4d4798dec7c87c92a86c882948ac3de (patch)
tree1b61087c042a8830227f898255af4a7f75d2ac6e /src
parentfdf8f867fa1a1d2493052b19bd50907f1b5d75e8 (diff)
downloaddotty-5f7eadf3f4d4798dec7c87c92a86c882948ac3de.tar.gz
dotty-5f7eadf3f4d4798dec7c87c92a86c882948ac3de.tar.bz2
dotty-5f7eadf3f4d4798dec7c87c92a86c882948ac3de.zip
Strenghten condition in EtaExpandIfLambda
Without the additional `typeParams.nonEmpty` condition we got a crash in t1439.scala
Diffstat (limited to 'src')
-rw-r--r--src/dotty/tools/dotc/core/TypeApplications.scala4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/TypeApplications.scala b/src/dotty/tools/dotc/core/TypeApplications.scala
index 6d3b7ac47..a97441681 100644
--- a/src/dotty/tools/dotc/core/TypeApplications.scala
+++ b/src/dotty/tools/dotc/core/TypeApplications.scala
@@ -540,8 +540,10 @@ class TypeApplications(val self: Type) extends AnyVal {
self.appliedTo(tparams map (_.typeRef)).LambdaAbstract(tparams)
}
+ /** Eta expand if `bound` is a type lambda */
def EtaExpandIfLambda(bound: Type)(implicit ctx: Context): Type =
- if (bound.isLambda && self.typeSymbol.isClass && !isLambda) EtaExpand else self
+ if (bound.isLambda && self.typeSymbol.isClass && typeParams.nonEmpty && !isLambda) EtaExpand
+ else self
/** Test whether this type has a base type of the form `B[T1, ..., Bn]` where
* the type parameters of `B` match one-by-one the variances of `tparams`,