From af6f913bb2dd5111e2eccbced878b48c57b250fb Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Tue, 9 Jul 2019 16:56:59 +0200 Subject: [PATCH] Fix #6828: Support by-name synthesized implicits --- compiler/src/dotty/tools/dotc/typer/Implicits.scala | 2 +- tests/pos/i6828.scala | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 tests/pos/i6828.scala diff --git a/compiler/src/dotty/tools/dotc/typer/Implicits.scala b/compiler/src/dotty/tools/dotc/typer/Implicits.scala index 2bf9f176028b..02747b46bb72 100644 --- a/compiler/src/dotty/tools/dotc/typer/Implicits.scala +++ b/compiler/src/dotty/tools/dotc/typer/Implicits.scala @@ -1067,7 +1067,7 @@ trait Implicits { self: Typer => } val base = baseWithRefinements(formal) val result = - if (base <:< formal) { + if (base <:< formal.widenExpr) { // With the subtype test we enforce that the searched type `formal` is of the right form handler(base, span)(ctx) } diff --git a/tests/pos/i6828.scala b/tests/pos/i6828.scala new file mode 100644 index 000000000000..b0e73e5e0225 --- /dev/null +++ b/tests/pos/i6828.scala @@ -0,0 +1,5 @@ +class Foo { + inline def foo[T](implicit ct: =>scala.reflect.ClassTag[T]): Unit = Unit + foo[Int] + foo[String] +}