aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Implicits.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-02-13 14:50:04 +0100
committerMartin Odersky <odersky@gmail.com>2014-02-13 14:50:04 +0100
commitc4bed34b009ffc54b1eac10ee75fba27040f1533 (patch)
tree956b51a53a1b0c5358cca63bf3f4ee47abb59c38 /src/dotty/tools/dotc/typer/Implicits.scala
parent80acc2d331cf8359c00d9a15c8cc10d537be503a (diff)
downloaddotty-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/typer/Implicits.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Implicits.scala7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/typer/Implicits.scala b/src/dotty/tools/dotc/typer/Implicits.scala
index 5e5077cc4..74e79269f 100644
--- a/src/dotty/tools/dotc/typer/Implicits.scala
+++ b/src/dotty/tools/dotc/typer/Implicits.scala
@@ -56,9 +56,9 @@ object Implicits {
case mt: MethodType =>
mt.isImplicit ||
mt.paramTypes.length != 1 ||
- !(argType <:< ((new WildApprox) apply mt.paramTypes.head))(ctx.fresh.withExploreTyperState)
+ !(argType <:< wildApprox(mt.paramTypes.head)(ctx.fresh.withExploreTyperState))
case rtp =>
- discardForView((new WildApprox) apply rtp, argType)
+ discardForView(wildApprox(rtp), argType)
}
case tpw: TermRef =>
false // can't discard overloaded refs
@@ -270,6 +270,7 @@ trait ImplicitRunInfo { self: RunInfo =>
*/
object liftToClasses extends TypeMap {
private implicit val ctx: Context = liftingCtx
+ override def stopAtStatic = true
def apply(tp: Type) = tp match {
case tp: TypeRef if tp.symbol.isAbstractOrAliasType =>
val pre = tp.prefix
@@ -439,7 +440,7 @@ trait Implicits { self: Typer =>
}
/** The expected type where parameters and uninstantiated typevars are replaced by wildcard types */
- val wildProto = implicitProto(pt, new WildApprox)
+ val wildProto = implicitProto(pt, wildApprox(_))
/** Search failures; overridden in ExplainedImplicitSearch */
protected def nonMatchingImplicit(ref: TermRef): SearchFailure = NoImplicitMatches