Skip to content

Over-zealous warning about unintended implicit conversion #10259

Closed
@rjolly

Description

@rjolly

Minimized code and Output

trait S[T] extends (T => T):
  def apply(x: T) = ???
  extension (x: T) def show: String

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

println(10.show)
        ^^
The conversion given_S_Int.type 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.

Expectation

It is not clear to me why the conversion should be considered here (at the extension method application). This warning should not be emitted, especially when not in -source:3.0-migration ; see #9998

Workaround

If we remove extends (T => T) the warning disappears.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions