Skip to content

Commit aa3f1f6

Browse files
committed
Fix #6828: Support by-name synthesized implicits
1 parent cba756d commit aa3f1f6

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

compiler/src/dotty/tools/dotc/typer/Implicits.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1066,8 +1066,9 @@ trait Implicits { self: Typer =>
10661066
tp.baseType(cls)
10671067
}
10681068
val base = baseWithRefinements(formal)
1069+
val formal1 = formal.resultType // Drop ExprType
10691070
val result =
1070-
if (base <:< formal) {
1071+
if (base <:< formal1) {
10711072
// With the subtype test we enforce that the searched type `formal` is of the right form
10721073
handler(base, span)(ctx)
10731074
}

tests/pos/i6828.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class Foo {
2+
inline def foo[T](implicit ct: =>scala.reflect.ClassTag[T]): Unit = Unit
3+
foo[Int]
4+
foo[String]
5+
}

0 commit comments

Comments
 (0)