Skip to content

Commit

Permalink
Revert "Make fix for SI-5452 not break other things."
Browse files Browse the repository at this point in the history
This reverts commit a725bf9.
  • Loading branch information
paulp committed Feb 15, 2012
1 parent a29173a commit 9655faf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
4 changes: 3 additions & 1 deletion src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
Expand Up @@ -714,9 +714,11 @@ 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) = {
Expand Down
7 changes: 1 addition & 6 deletions src/compiler/scala/tools/nsc/typechecker/Infer.scala
Expand Up @@ -1466,9 +1466,7 @@ 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)

Expand All @@ -1490,11 +1488,8 @@ 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) {
Expand Down
4 changes: 1 addition & 3 deletions test/files/neg/t5452.check
@@ -1,7 +1,5 @@
t5452.scala:28: error: overloaded method value apply with alternatives:
()Queryable[CoffeesTable] <and>
(t: Tree)(implicit evidence$2: Manifest[CoffeesTable])Nothing <and>
(implicit evidence$1: Manifest[CoffeesTable])Nothing

cannot be applied to (Queryable[CoffeesTable])
Queryable[CoffeesTable]( q.treeFilter(null) )
^
Expand Down

0 comments on commit 9655faf

Please sign in to comment.