Skip to content

Commit ca02d83

Browse files
authored
Merge pull request #10939 from prolativ/fix-implicit-conversion-warnings
Fix #10259: Don't complain about old style conversion for extension method
2 parents 029ae77 + 6cceb9a commit ca02d83

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -792,8 +792,8 @@ trait Implicits:
792792
val inferred = inferImplicit(adjust(to), from, from.span)
793793

794794
inferred match {
795-
case SearchSuccess(_, ref, _) =>
796-
if isOldStyleFunctionConversion(ref.underlying) then
795+
case SearchSuccess(tree, ref, _)
796+
if isOldStyleFunctionConversion(ref.underlying) && !tree.isInstanceOf[Applications.ExtMethodApply] =>
797797
report.migrationWarning(
798798
i"The conversion ${ref} will not be applied implicitly here in Scala 3 because only implicit methods and instances of Conversion class will continue to work as implicit views.",
799799
from
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
trait S[T] extends (T => T):
2+
def apply(x: T) = ???
3+
extension (x: T) def show: String
4+
5+
given S[Int] with
6+
extension (x: Int) def show = x.toString
7+
8+
val x = 10.show

0 commit comments

Comments
 (0)