From 78a50f2da9ff9f72ce241c5df3d152ca88f3f7b3 Mon Sep 17 00:00:00 2001 From: Miles Sabin Date: Mon, 25 Mar 2019 13:36:19 +0000 Subject: [PATCH] Use correct type equality in divergence check Fixes #6058. --- compiler/src/dotty/tools/dotc/typer/Implicits.scala | 2 +- tests/neg/i6058.scala | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 tests/neg/i6058.scala diff --git a/compiler/src/dotty/tools/dotc/typer/Implicits.scala b/compiler/src/dotty/tools/dotc/typer/Implicits.scala index 15902b90ad20..b1475c01f735 100644 --- a/compiler/src/dotty/tools/dotc/typer/Implicits.scala +++ b/compiler/src/dotty/tools/dotc/typer/Implicits.scala @@ -1382,7 +1382,7 @@ abstract class SearchHistory { outer => val wideTp = tp.widenExpr lazy val wildTp = wildApprox(wideTp) if (belowByname && (wildTp <:< wildPt)) false - else if ((wideTp.typeSize < ptSize && wideTp.coveringSet == ptCoveringSet) || (wildTp == wildPt)) true + else if ((wideTp.typeSize < ptSize && wideTp.coveringSet == ptCoveringSet) || (wildTp =:= wildPt)) true else loop(tl, isByname(tp) || belowByname) } else loop(tl, isByname(tp) || belowByname) diff --git a/tests/neg/i6058.scala b/tests/neg/i6058.scala new file mode 100644 index 000000000000..612bd9066b02 --- /dev/null +++ b/tests/neg/i6058.scala @@ -0,0 +1,3 @@ +object Test { + implicit def i1[I2, I3](i4: I2)(implicit i5: I2 => I3): I3 = ( ) // error +}