From 9e63bf253c169d6b2a2e74f65b3a4029f0781655 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Thu, 9 Jan 2014 20:30:45 +0100 Subject: Better error message for failed overloading resolution. Indicate only thhose alternatives that remain after narrowing. --- src/dotty/tools/dotc/typer/Typer.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/dotty/tools/dotc/typer/Typer.scala') diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 4c55b9d4f..b3511841d 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -1117,9 +1117,10 @@ class Typer extends Namer with Applications with Implicits { noMatches } case alts => - def all = if (altDenots.length == 2) "both" else "all" + val remainingDenots = alts map (_.denot.asInstanceOf[SingleDenotation]) + def all = if (remainingDenots.length == 2) "both" else "all" errorTree(tree, - i"""Ambiguous overload. The ${err.overloadedAltsStr(altDenots)} + i"""Ambiguous overload. The ${err.overloadedAltsStr(remainingDenots)} |$all match $expectedStr""".stripMargin) } } -- cgit v1.2.3