diff options
author | Martin Odersky <odersky@gmail.com> | 2015-09-21 12:46:35 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-09-21 12:50:05 +0200 |
commit | 71e3133ef65b06a5bce605cd4f0ebf879cc05118 (patch) | |
tree | 1faffde9a7ef4e882ef8ba5c8dcd59719a4aa6a0 /src/dotty/tools/dotc/typer/Checking.scala | |
parent | 154f3511d52c6b748c03d97dd035f0ad79f9a355 (diff) | |
download | dotty-71e3133ef65b06a5bce605cd4f0ebf879cc05118.tar.gz dotty-71e3133ef65b06a5bce605cd4f0ebf879cc05118.tar.bz2 dotty-71e3133ef65b06a5bce605cd4f0ebf879cc05118.zip |
Eta expand $apply projected types if needed
It turns out that asSeenFrom can produce types
that get projected with $apply but that are not
higher-kinded. An exampple failure is in Iter3,
andother in scala.collection.immutable.Map (which is
now part of the test suite).
We now detect that situation, and eta expand the
projected type in `derivedSelect`, this will
force a subssequent `lookupRefined` which will give
the desired normalized type.
Also added is a configurable test that checks that
$apply projected tyeps are in fact higher-kinded.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Checking.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Checking.scala | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/src/dotty/tools/dotc/typer/Checking.scala b/src/dotty/tools/dotc/typer/Checking.scala index 3847cb5be..8376dd4e9 100644 --- a/src/dotty/tools/dotc/typer/Checking.scala +++ b/src/dotty/tools/dotc/typer/Checking.scala @@ -115,18 +115,8 @@ object Checking { val parent1 = this(parent) val saved = cycleOK cycleOK = nestedCycleOK - - /** A derived refined type with two possible tweaks: - * (1) LazyRefs in parents are pulled out, - * (2) #Apply is added if the type is a fully applied type lambda. - */ - def derivedType(p: Type): Type = p match { - case p: LazyRef => LazyRef(() => derivedType(p.ref)) - case _ => - val res = tp.derivedRefinedType(p, name, this(tp.refinedInfo)) - if (res.isSafeLambda && res.typeParams.isEmpty) res.select(tpnme.Apply) else res - } - try derivedType(parent1) finally cycleOK = saved + try tp.derivedRefinedType(parent1, name, this(tp.refinedInfo)) + finally cycleOK = saved case tp @ TypeRef(pre, name) => try { // A prefix is interesting if it might contain (transitively) a reference |