Skip to content

Fix #10259: Don't complain about old style conversion for extension method #10939

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/typer/Implicits.scala
Original file line number Diff line number Diff line change
Expand Up @@ -792,8 +792,8 @@ trait Implicits:
val inferred = inferImplicit(adjust(to), from, from.span)

inferred match {
case SearchSuccess(_, ref, _) =>
if isOldStyleFunctionConversion(ref.underlying) then
case SearchSuccess(tree, ref, _)
if isOldStyleFunctionConversion(ref.underlying) && !tree.isInstanceOf[Applications.ExtMethodApply] =>
report.migrationWarning(
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.",
from
Expand Down
8 changes: 8 additions & 0 deletions tests/pos-special/fatal-warnings/i10259.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
trait S[T] extends (T => T):
def apply(x: T) = ???
extension (x: T) def show: String

given S[Int] with
extension (x: Int) def show = x.toString

val x = 10.show