summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2009-03-30 22:18:24 +0000
committerMartin Odersky <odersky@gmail.com>2009-03-30 22:18:24 +0000
commitc1be9a8a7f797edf52b16c52288d18c7dba38440 (patch)
tree34f1a6f8714dbc490225d4a79eda5b7387b7a8f1 /src/compiler
parent20f986ecf42cf3018bf3a90b84b2f84669838b10 (diff)
downloadscala-c1be9a8a7f797edf52b16c52288d18c7dba38440.tar.gz
scala-c1be9a8a7f797edf52b16c52288d18c7dba38440.tar.bz2
scala-c1be9a8a7f797edf52b16c52288d18c7dba38440.zip
hopefully fixed problem in overloading resoluti...
hopefully fixed problem in overloading resolution that caused eclipse plugin build to fail
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Infer.scala6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
index 55140899ac..3e267fcda2 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
@@ -428,7 +428,10 @@ trait Infer {
}
def isWeaklyCompatible(tp: Type, pt: Type): Boolean =
- pt.typeSymbol == UnitClass || isCompatible(tp, pt)
+ pt.typeSymbol == UnitClass || // can perform unit coercion
+ isCompatible(tp, pt) ||
+ tp.isInstanceOf[MethodType] && // can perform implicit () instantiation
+ tp.paramTypes.length == 0 && isCompatible(tp.resultType, pt)
def isCoercible(tp: Type, pt: Type): Boolean = false
@@ -1341,6 +1344,7 @@ trait Infer {
def inferExprAlternative(tree: Tree, pt: Type): Unit = tree.tpe match {
case OverloadedType(pre, alts) => tryTwice {
var alts1 = alts filter (alt => isWeaklyCompatible(pre.memberType(alt), pt))
+ //println("trying "+alts1+(alts1 map (_.tpe))+(alts1 map (_.locationString))+" for "+pt)
val applicable = alts1
var secondTry = false
if (alts1.isEmpty) {