From c4bed34b009ffc54b1eac10ee75fba27040f1533 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Thu, 13 Feb 2014 14:50:04 +0100 Subject: Two performance optimizations 1) Split out wildApprox into separate function 2) Be more careful not to follow static prefix chains where not needed --- src/dotty/tools/dotc/core/TypeOps.scala | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/dotty/tools/dotc/core/TypeOps.scala') 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) } -- cgit v1.2.3