diff options
author | Paul Phillips <paulp@improving.org> | 2012-02-14 06:16:09 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-02-14 06:18:19 -0800 |
commit | a725bf982c06e16c5d533ea6b2227b726db4f7e4 (patch) | |
tree | 9348691a431d3b3a370e36db455a15da4e7a687f /src | |
parent | bd988df6448bfeacf8fa6bf35b21881d3073a547 (diff) | |
download | scala-a725bf982c06e16c5d533ea6b2227b726db4f7e4.tar.gz scala-a725bf982c06e16c5d533ea6b2227b726db4f7e4.tar.bz2 scala-a725bf982c06e16c5d533ea6b2227b726db4f7e4.zip |
Make fix for SI-5452 not break other things.
If this looks hacky, that's because it is.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala | 4 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Infer.scala | 7 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala index 466b5125a8..6ee09d064f 100644 --- a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala +++ b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala @@ -714,11 +714,9 @@ trait ContextErrors { setError(tree) } - def NoBestMethodAlternativeError(tree: Tree, argtpes: List[Type], pt: Type) = { + def NoBestMethodAlternativeError(tree: Tree, argtpes: List[Type], pt: Type) = issueNormalTypeError(tree, applyErrorMsg(tree, " cannot be applied to ", argtpes, pt)) - setError(tree) - } def AmbiguousMethodAlternativeError(tree: Tree, pre: Type, best: Symbol, firstCompeting: Symbol, argtpes: List[Type], pt: Type) = { diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala index b97fbebec2..acf905d974 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala @@ -1466,7 +1466,9 @@ trait Infer { argtpes: List[Type], pt0: Type, varArgsOnly: Boolean = false): Unit = tree.tpe match { case OverloadedType(pre, alts) => val pt = if (pt0.typeSymbol == UnitClass) WildcardType else pt0 + var secondTry = true tryTwice { + secondTry = !secondTry debuglog("infer method alt "+ tree.symbol +" with alternatives "+ (alts map pre.memberType) +", argtpes = "+ argtpes +", pt = "+ pt) @@ -1488,8 +1490,11 @@ trait Infer { if (improves(alt, best)) alt else best) val competing = applicable.dropWhile(alt => best == alt || improves(best, alt)) if (best == NoSymbol) { - if (pt == WildcardType) + if (pt == WildcardType) { NoBestMethodAlternativeError(tree, argtpes, pt) + if (secondTry) + setError(tree) + } else inferMethodAlternative(tree, undetparams, argtpes, WildcardType) } else if (!competing.isEmpty) { |