diff options
author | Martin Odersky <odersky@gmail.com> | 2016-06-29 20:18:49 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-07-11 13:35:05 +0200 |
commit | 4093e138f682ce0c78eed36861962c1e68022098 (patch) | |
tree | ea20634122da8d69da478777391834fc8bac7da1 | |
parent | dca10528b40632860696d65cfe699d6dfcb62ec0 (diff) | |
download | dotty-4093e138f682ce0c78eed36861962c1e68022098.tar.gz dotty-4093e138f682ce0c78eed36861962c1e68022098.tar.bz2 dotty-4093e138f682ce0c78eed36861962c1e68022098.zip |
Don't dealias when applying types
Keep the higher-kinded application instead. This should be
better for inference. We have to evaluate the performance impact.
Maybe dealias if the kind stays the same?
Also, reduce Nothing[...] to Nothing
Nothing cannot be a type constructor in a
HK application because it does not have type
parameters. Avoid the problemn by the reduction above.
-rw-r--r-- | src/dotty/tools/dotc/core/TypeApplications.scala | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/core/TypeApplications.scala b/src/dotty/tools/dotc/core/TypeApplications.scala index 714d2a5e3..e989e42b7 100644 --- a/src/dotty/tools/dotc/core/TypeApplications.scala +++ b/src/dotty/tools/dotc/core/TypeApplications.scala @@ -744,7 +744,7 @@ class TypeApplications(val self: Type) extends AnyVal { case self1: WildcardType => self1 case _ => - self.safeDealias.appliedTo(args, typeParams) + self.appliedTo(args, typeParams) } } @@ -768,7 +768,7 @@ class TypeApplications(val self: Type) extends AnyVal { case nil => t } assert(args.nonEmpty) - self.stripTypeVar match { + self.stripTypeVar.safeDealias match { case self: TypeLambda => if (!args.exists(_.isInstanceOf[TypeBounds])) self.instantiate(args) else { @@ -785,10 +785,12 @@ class TypeApplications(val self: Type) extends AnyVal { self.derivedTypeBounds(self.lo, self.hi.appliedTo(args)) case self: LazyRef => LazyRef(() => self.ref.appliedTo(args, typParams)) + case self: TypeRef if self.symbol == defn.NothingClass => + self case _ if typParams.isEmpty || typParams.head.isInstanceOf[LambdaParam] => HKApply(self, args) - case _ => - matchParams(self, typParams, args) match { + case dealiased => + matchParams(dealiased, typParams, args) match { case refined @ RefinedType(_, pname, _) if !Config.newHK && pname.isHkArgNameOLD => refined.betaReduceOLD case refined => |