aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-12-20 11:50:32 +0100
committerMartin Odersky <odersky@gmail.com>2015-12-20 11:50:49 +0100
commitbde77d4c43dd994e0b9bd7feb9abf74bb9678e12 (patch)
treefb1605b0fb852e016c9e577616393c9b682e02f0 /src
parentded374a5229a17c5c6dc04e50044d62422dc1023 (diff)
downloaddotty-bde77d4c43dd994e0b9bd7feb9abf74bb9678e12.tar.gz
dotty-bde77d4c43dd994e0b9bd7feb9abf74bb9678e12.tar.bz2
dotty-bde77d4c43dd994e0b9bd7feb9abf74bb9678e12.zip
Don't do eta expansion on bottom types
Diffstat (limited to 'src')
-rw-r--r--src/dotty/tools/dotc/core/TypeApplications.scala10
-rw-r--r--src/dotty/tools/dotc/core/Types.scala12
2 files changed, 11 insertions, 11 deletions
diff --git a/src/dotty/tools/dotc/core/TypeApplications.scala b/src/dotty/tools/dotc/core/TypeApplications.scala
index 9a12d2635..7d1b36db0 100644
--- a/src/dotty/tools/dotc/core/TypeApplications.scala
+++ b/src/dotty/tools/dotc/core/TypeApplications.scala
@@ -373,14 +373,10 @@ class TypeApplications(val self: Type) extends AnyVal {
//.ensuring(res => res.EtaReduce =:= self, s"res = $res, core = ${res.EtaReduce}, self = $self, hc = ${res.hashCode}")
}
- /** Eta expand the prefix in front of any refinements.
- * @param tparamsForBottom Type parameters to use if core is a bottom type
- */
- def EtaExpandCore(tparamsForBottom: List[TypeSymbol])(implicit ctx: Context): Type = self.stripTypeVar match {
+ /** Eta expand the prefix in front of any refinements. */
+ def EtaExpandCore(implicit ctx: Context): Type = self.stripTypeVar match {
case self: RefinedType =>
- self.derivedRefinedType(self.parent.EtaExpandCore(tparamsForBottom), self.refinedName, self.refinedInfo)
- case tp: TypeRef if defn.isBottomClass(tp.symbol) =>
- self.LambdaAbstract(tparamsForBottom)
+ self.derivedRefinedType(self.parent.EtaExpandCore, self.refinedName, self.refinedInfo)
case _ =>
self.EtaExpand(self.typeParams)
}
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 624549bac..13f1ff9a9 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -1538,8 +1538,10 @@ object Types {
*
* T#A --> B if A is bound to an alias `= B` in T
*
- * (S & T)#A --> S#A if T does not have a member namd A
- * --> T#A if S does not have a member namd A
+ * If Config.splitProjections is set:
+ *
+ * (S & T)#A --> S#A if T does not have a member named A
+ * --> T#A if S does not have a member named A
* --> S#A & T#A otherwise
* (S | T)#A --> S#A | T#A
*/
@@ -1548,11 +1550,13 @@ object Types {
else if (isType) {
val res = prefix.lookupRefined(name)
if (res.exists) res
- else if (name == tpnme.hkApply && prefix.classNotLambda)
+ else if (name == tpnme.hkApply && prefix.classNotLambda) {
// After substitution we might end up with a type like
// `C { type hk$0 = T0; ...; type hk$n = Tn } # $Apply`
// where C is a class. In that case we eta expand `C`.
- derivedSelect(prefix.EtaExpandCore(this.prefix.typeConstructor.typeParams))
+ if (defn.isBottomType(prefix)) prefix.classSymbol.typeRef
+ else derivedSelect(prefix.EtaExpandCore)
+ }
else if (Config.splitProjections)
prefix match {
case prefix: AndType =>