diff options
author | Martin Odersky <odersky@gmail.com> | 2014-02-01 18:15:14 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-02-01 18:15:14 +0100 |
commit | 7ba59b1f8c86bdad79ceed3d21b1fc83bda76d7b (patch) | |
tree | 6129635f5375b296bd6fbe71e55644f8eedf342e /src/dotty/tools/dotc/typer/Inferencing.scala | |
parent | ceb4dd9589da30540d2ab812f5ca90298aa4b070 (diff) | |
download | dotty-7ba59b1f8c86bdad79ceed3d21b1fc83bda76d7b.tar.gz dotty-7ba59b1f8c86bdad79ceed3d21b1fc83bda76d7b.tar.bz2 dotty-7ba59b1f8c86bdad79ceed3d21b1fc83bda76d7b.zip |
Refactoring implicit discards
(1) Moved into refMatches, to avoid normalize on references that are discarded anyway
(2) Added another check if the expected type is a value class
Diffstat (limited to 'src/dotty/tools/dotc/typer/Inferencing.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Inferencing.scala | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/src/dotty/tools/dotc/typer/Inferencing.scala b/src/dotty/tools/dotc/typer/Inferencing.scala index 3dff1c728..5ba644b9c 100644 --- a/src/dotty/tools/dotc/typer/Inferencing.scala +++ b/src/dotty/tools/dotc/typer/Inferencing.scala @@ -209,31 +209,7 @@ object Inferencing { // case _ => false // } def isMatchedBy(tp: Type)(implicit ctx: Context): Boolean = /*ctx.conditionalTraceIndented(lookingForInfo, i"?.info isMatchedBy $tp ${tp.getClass}")*/ { - def discard(tp: Type): Boolean = tp.widen match { - case tpw: MethodType => - tpw.isImplicit || - tpw.paramTypes.length != 1 || - !(argType <:< tpw.paramTypes.head)(ctx.fresh.withExploreTyperState) - case tpw: PolyType => - discard((new WildApprox) apply tpw.resultType) - case tpw: TermRef => - false // can't discard overloaded refs - case tpw => - def isConforms(sym: Symbol) = - sym.exists && sym.owner == defn.ScalaPredefModule.moduleClass && sym.name == tpnme.Conforms - if (isConforms(tpw.typeSymbol)) false // todo: figure out why we need conforms - else { - //if (ctx.typer.isApplicable(tp, argType :: Nil, resultType)) - // println(i"??? $tp is applicable to $this / typeSymbol = ${tpw.typeSymbol}") - true - } - } - - if (discard(tp)) { - Stats.record("discarded eligible") - false - } - else ctx.typer.isApplicable(tp, argType :: Nil, resultType) + ctx.typer.isApplicable(tp, argType :: Nil, resultType) } def derivedViewProto(argType: Type, resultType: Type)(implicit ctx: Context) = |