diff options
author | Martin Odersky <odersky@gmail.com> | 2014-02-13 14:50:04 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-02-13 14:50:04 +0100 |
commit | c4bed34b009ffc54b1eac10ee75fba27040f1533 (patch) | |
tree | 956b51a53a1b0c5358cca63bf3f4ee47abb59c38 /src/dotty/tools/dotc/core/TypeOps.scala | |
parent | 80acc2d331cf8359c00d9a15c8cc10d537be503a (diff) | |
download | dotty-c4bed34b009ffc54b1eac10ee75fba27040f1533.tar.gz dotty-c4bed34b009ffc54b1eac10ee75fba27040f1533.tar.bz2 dotty-c4bed34b009ffc54b1eac10ee75fba27040f1533.zip |
Two performance optimizations
1) Split out wildApprox into separate function
2) Be more careful not to follow static prefix chains where not needed
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeOps.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/TypeOps.scala | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/core/TypeOps.scala b/src/dotty/tools/dotc/core/TypeOps.scala index 6e984e43c..afa39f2a3 100644 --- a/src/dotty/tools/dotc/core/TypeOps.scala +++ b/src/dotty/tools/dotc/core/TypeOps.scala @@ -50,8 +50,11 @@ trait TypeOps { this: Context => /** Implementation of Types#simplified */ final def simplify(tp: Type, theMap: SimplifyMap): Type = tp match { case tp: NamedType => - tp.derivedSelect(simplify(tp.prefix, theMap)) - case _: ThisType | NoPrefix => + if (tp.symbol.isStatic) tp + else tp.derivedSelect(simplify(tp.prefix, theMap)) + case tp: PolyParam => + typerState.constraint.typeVarOfParam(tp) orElse tp + case _: ThisType | _: BoundType | NoPrefix => tp case tp: RefinedType => tp.derivedRefinedType(simplify(tp.parent, theMap), tp.refinedName, simplify(tp.refinedInfo, theMap)) @@ -59,8 +62,6 @@ trait TypeOps { this: Context => simplify(l, theMap) & simplify(r, theMap) case OrType(l, r) => simplify(l, theMap) | simplify(r, theMap) - case tp: PolyParam => - typerState.constraint.typeVarOfParam(tp) orElse tp case _ => (if (theMap != null) theMap else new SimplifyMap).mapOver(tp) } |