scala> def getClassSafe(fullName: String): Option[String] = try {
| Some(definitions.getClass(newTypeName(fullName)))
| } catch {
| case _: MissingRequirementError => None
| }
<console>:39: error: too many arguments for overloaded method value getClass with alternatives:
Some(definitions.getClass(newTypeName(fullName)))
^
note the cliff hanger, there -- no alternatives are reported
I think the problem is that the getClass symbol is overloaded, but the tree's type is already by the time the error message is synthesized (the error arises from the erroroneous return type Option[String])
Taking the relevant pieces of code:
if (sym.isOverloaded) overloadedMessage
def overloadedMessage = "overloaded method " + sym + " with alternatives:\n" + alternativesString(tree)
def alternativesString(tree: Tree) =
alternatives(tree) map (x => " " + methodTypeErrorString(x)) mkString ("", " <and>\n", "\n")
def alternatives(tree: Tree): List[Type] = tree.tpe match {
case OverloadedType(pre, alternatives) => alternatives map pre.memberType
this assumes tree.symbol.isOverloaded implies tree.tpe.isInstanceOf[OverloadedType], which this bug illustrates is not necessarily the case
note the cliff hanger, there -- no alternatives are reported
I think the problem is that the getClass symbol is overloaded, but the tree's type is already by the time the error message is synthesized (the error arises from the erroroneous return type
Option[String])Taking the relevant pieces of code:
this assumes
tree.symbol.isOverloadedimpliestree.tpe.isInstanceOf[OverloadedType], which this bug illustrates is not necessarily the case