diff options
author | Martin Odersky <odersky@gmail.com> | 2009-11-22 11:32:26 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2009-11-22 11:32:26 +0000 |
commit | aa2c129e41318ef973327459706e65e50e0e6a3a (patch) | |
tree | 1b0e13b19fed0c971ae6c21e6865728e766ab6bc /src/compiler/scala/tools/nsc/typechecker/Implicits.scala | |
parent | 19dc226f24461aa3c1a81f6b79ce985cfcfc2edd (diff) | |
download | scala-aa2c129e41318ef973327459706e65e50e0e6a3a.tar.gz scala-aa2c129e41318ef973327459706e65e50e0e6a3a.tar.bz2 scala-aa2c129e41318ef973327459706e65e50e0e6a3a.zip |
Made implicit resolution compatible with numeri...
Made implicit resolution compatible with numeric conformance.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Implicits.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Implicits.scala | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index 6bbacfa311..ed5b64138f 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -368,21 +368,28 @@ self: Analyzer => * correspond to the HasMethodMatching type, * or otherwise if `tp' is compatible with `pt'. */ - def matchesPt(tp: Type, pt: Type, undet: List[Symbol]) = - isCompatible(tp, pt) || { + def matchesPt(tp: Type, pt: Type, undet: List[Symbol]) = { + isCompatible(tp, pt) || + isView && { pt match { - case Function1(arg, HasMethodMatching(name, argtpes, restpe)) => + case Function1(arg, res) => normalize(tp) match { case Function1(arg1, res1) => - (arg <:< arg1) && - (res1.member(name) filter (m => isApplicableSafe(undet, m.tpe, argtpes, restpe))) != NoSymbol - case _ => - false + (arg.deconst weak_<:< arg1) && { + res match { + case HasMethodMatching(name, argtpes, restpe) => + (res1.member(name) filter (m => + isApplicableSafe(undet, m.tpe, argtpes, restpe))) != NoSymbol + case _ => + res1 <:< res + } + } + case _ => false } - case _ => - false + case _ => false } } + } //if (traceImplicits) println("typed impl for "+wildPt+"? "+info.name+":"+depoly(info.tpe)+"/"+undetParams+"/"+isPlausiblyCompatible(info.tpe, wildPt)+"/"+matchesPt(depoly(info.tpe), wildPt, List())) if (isPlausiblyCompatible(info.tpe, wildPt) && |