diff options
author | Martin Odersky <odersky@gmail.com> | 2015-12-20 11:50:32 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-12-20 11:50:49 +0100 |
commit | bde77d4c43dd994e0b9bd7feb9abf74bb9678e12 (patch) | |
tree | fb1605b0fb852e016c9e577616393c9b682e02f0 /src/dotty/tools/dotc/core/Types.scala | |
parent | ded374a5229a17c5c6dc04e50044d62422dc1023 (diff) | |
download | dotty-bde77d4c43dd994e0b9bd7feb9abf74bb9678e12.tar.gz dotty-bde77d4c43dd994e0b9bd7feb9abf74bb9678e12.tar.bz2 dotty-bde77d4c43dd994e0b9bd7feb9abf74bb9678e12.zip |
Don't do eta expansion on bottom types
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 12 |
1 files changed, 8 insertions, 4 deletions
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 => |