diff options
author | Martin Odersky <odersky@gmail.com> | 2014-11-16 19:22:21 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-11-24 14:54:58 +0100 |
commit | 38b2a61e3dba6160292943a481ccf2b85a695ba7 (patch) | |
tree | 401db93fdf090106fab48a5b76eccadad9a40572 /src/dotty/tools/dotc/core/TypeOps.scala | |
parent | 779afd2f65f967ec5af1ac5ec7464ad5851852ad (diff) | |
download | dotty-38b2a61e3dba6160292943a481ccf2b85a695ba7.tar.gz dotty-38b2a61e3dba6160292943a481ccf2b85a695ba7.tar.bz2 dotty-38b2a61e3dba6160292943a481ccf2b85a695ba7.zip |
Improve simplifications of type projections.
An example where this helps:
Previously, the private value `mnemonics` in Coder.scala was fof the form
Lambda$IP { ... } # Apply
It now simplifies to a Map[...] type.
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeOps.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/TypeOps.scala | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/TypeOps.scala b/src/dotty/tools/dotc/core/TypeOps.scala index 7a853ae12..1ef997684 100644 --- a/src/dotty/tools/dotc/core/TypeOps.scala +++ b/src/dotty/tools/dotc/core/TypeOps.scala @@ -56,7 +56,13 @@ trait TypeOps { this: Context => final def simplify(tp: Type, theMap: SimplifyMap): Type = tp match { case tp: NamedType => if (tp.symbol.isStatic) tp - else tp.derivedSelect(simplify(tp.prefix, theMap)) + else tp.derivedSelect(simplify(tp.prefix, theMap)) match { + case tp1: NamedType if tp1.denotationIsCurrent => + val tp2 = tp1.reduceProjection + //if (tp2 ne tp1) println(i"simplified $tp1 -> $tp2") + tp2 + case tp1 => tp1 + } case tp: PolyParam => typerState.constraint.typeVarOfParam(tp) orElse tp case _: ThisType | _: BoundType | NoPrefix => |