diff options
author | Martin Odersky <odersky@gmail.com> | 2015-04-06 13:26:07 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-04-07 23:53:59 +0200 |
commit | 3b53a8300f09c11a9fc889dbe59061a6941d21cc (patch) | |
tree | c77b258f5195c95f0dc7f335666677b935edcd33 /src/dotty/tools/dotc/core/TypeApplications.scala | |
parent | 26881a91ca838708329f6ebdb82b603823a0ad25 (diff) | |
download | dotty-3b53a8300f09c11a9fc889dbe59061a6941d21cc.tar.gz dotty-3b53a8300f09c11a9fc889dbe59061a6941d21cc.tar.bz2 dotty-3b53a8300f09c11a9fc889dbe59061a6941d21cc.zip |
Homogenize #Apply projections.
Simplify fully applied #Apply projections before comparing trees.
Such projections are now (correctly) simplified on unpickling
but persist in the original tree before pickling.
The discrepancy was uncovered by the last commit.
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeApplications.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/TypeApplications.scala | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/TypeApplications.scala b/src/dotty/tools/dotc/core/TypeApplications.scala index 02526a30b..6c3fef1a9 100644 --- a/src/dotty/tools/dotc/core/TypeApplications.scala +++ b/src/dotty/tools/dotc/core/TypeApplications.scala @@ -191,6 +191,17 @@ class TypeApplications(val self: Type) extends AnyVal { if (res.isInstantiatedLambda) res.select(tpnme.Apply) else res } } + + /** Simplify a fully instantiated type of the form `LambdaX{... type Apply = T } # Apply` to `T`. + */ + def simplifyApply(implicit ctx: Context): Type = self match { + case self @ TypeRef(prefix, tpnme.Apply) if prefix.isInstantiatedLambda => + prefix.member(tpnme.Apply).info match { + case TypeAlias(alias) => alias + case _ => self + } + case _ => self + } final def appliedTo(arg: Type)(implicit ctx: Context): Type = appliedTo(arg :: Nil) final def appliedTo(arg1: Type, arg2: Type)(implicit ctx: Context): Type = appliedTo(arg1 :: arg2 :: Nil) |