diff options
author | Martin Odersky <odersky@gmail.com> | 2015-12-11 14:39:41 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-12-11 14:39:41 +0100 |
commit | 88f24efb2858f46c146214bc7e51f5de17c31bc0 (patch) | |
tree | 111c8eff2a48d6373cddca4a9f1acd075c2afe84 /src | |
parent | b8e05d5b955de664e4a5872f43c8184014cecf05 (diff) | |
download | dotty-88f24efb2858f46c146214bc7e51f5de17c31bc0.tar.gz dotty-88f24efb2858f46c146214bc7e51f5de17c31bc0.tar.bz2 dotty-88f24efb2858f46c146214bc7e51f5de17c31bc0.zip |
Allow bottom types as hk type arguments
Fixes problem raised in #966.
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/core/TypeApplications.scala | 10 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/core/TypeApplications.scala b/src/dotty/tools/dotc/core/TypeApplications.scala index dabd2f2cd..b2f22da20 100644 --- a/src/dotty/tools/dotc/core/TypeApplications.scala +++ b/src/dotty/tools/dotc/core/TypeApplications.scala @@ -328,10 +328,14 @@ 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. */ - def EtaExpandCore(implicit ctx: Context): Type = self.stripTypeVar match { + /** 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 { case self: RefinedType => - self.derivedRefinedType(self.parent.EtaExpandCore, self.refinedName, self.refinedInfo) + self.derivedRefinedType(self.parent.EtaExpandCore(tparamsForBottom), self.refinedName, self.refinedInfo) + case tp: TypeRef if defn.isBottomClass(tp.symbol) => + self.LambdaAbstract(tparamsForBottom) case _ => self.EtaExpand(self.typeParams) } diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index b5d5c864b..a7c457d8f 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -1517,7 +1517,7 @@ object Types { // 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) + derivedSelect(prefix.EtaExpandCore(this.prefix.typeConstructor.typeParams)) } else newLikeThis(prefix) } |