From 08880b3ce03fa8f9a4b23671ef5d1d78816d28c5 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 17 Jan 2014 19:12:32 +0100 Subject: Avoid SuppressedError exceptions Note: "i" throws a supressed error to be caught in Reporters. Problem is this does not work if - "i" is evaluated in a val. That's normally an error anyway since error diagnostics should be evaluated lazily to avoid possibvly useless computation. - "i" is passed to a println in a Config.Printer. Not sure what to do about the latter. To avoid such an expression or handle it reasonably, we'd need access to the context base, which we do not have from Printers. --- src/dotty/tools/dotc/typer/Inferencing.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/dotty/tools/dotc/typer/Inferencing.scala') diff --git a/src/dotty/tools/dotc/typer/Inferencing.scala b/src/dotty/tools/dotc/typer/Inferencing.scala index e8a2548ae..6390ed51e 100644 --- a/src/dotty/tools/dotc/typer/Inferencing.scala +++ b/src/dotty/tools/dotc/typer/Inferencing.scala @@ -402,8 +402,8 @@ object Inferencing { typr.println(i"conflict? $decl $other") if (decl.signature matches other.signature) { def doubleDefError(decl: Symbol, other: Symbol): Unit = { - val ofType = if (decl.isType) "" else i": ${other.info}" - val explanation = + def ofType = if (decl.isType) "" else i": ${other.info}" + def explanation = if (!decl.isSourceMethod) "" else "\n (both definitions have the same erased type signature)" ctx.error(i"$decl is already defined as $other$ofType$explanation", decl.pos) -- cgit v1.2.3