Skip to content

Over-zealous warning about unintended implicit conversion #10259

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

Closed
rjolly opened this issue Nov 9, 2020 · 2 comments
Closed

Over-zealous warning about unintended implicit conversion #10259

rjolly opened this issue Nov 9, 2020 · 2 comments
Assignees

Comments

@rjolly
Copy link
Contributor

rjolly commented Nov 9, 2020

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.

@rjolly rjolly closed this as completed Nov 9, 2020
@smarter
Copy link
Member

smarter commented Nov 11, 2020

Was this issue intentionally closed? It seems valid to me.

@rjolly rjolly reopened this Nov 11, 2020
@rjolly
Copy link
Contributor Author

rjolly commented Nov 11, 2020

I was happy with the workaround. Re-opening it.

prolativ added a commit to prolativ/dotty that referenced this issue Dec 28, 2020
smarter added a commit that referenced this issue Dec 29, 2020
Fix #10259: Don't complain about old style conversion for extension method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants