From a40df059737a1b523bfa811596f1fce051e07477 Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Fri, 27 Mar 2015 23:45:02 +0100 Subject: [PATCH] Implicits#viewExists: return false after typer instead of AssertionError This way, tpd#applyOverloaded can safely be used after typer. This issue was encoutered while working on value classes, step 3 of SIP-15 contains the following peephole optimization: new C(e) == new C(f) => e == f Which requires us to do overloading resolution. --- src/dotty/tools/dotc/typer/Implicits.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dotty/tools/dotc/typer/Implicits.scala b/src/dotty/tools/dotc/typer/Implicits.scala index 23938ea998dd..1f5fd3899d64 100644 --- a/src/dotty/tools/dotc/typer/Implicits.scala +++ b/src/dotty/tools/dotc/typer/Implicits.scala @@ -380,6 +380,7 @@ trait Implicits { self: Typer => override def viewExists(from: Type, to: Type)(implicit ctx: Context): Boolean = ( !from.isError && !to.isError + && !ctx.isAfterTyper && (ctx.mode is Mode.ImplicitsEnabled) && { from.widenExpr match { case from: TypeRef if defn.ScalaValueClasses contains from.symbol =>