Skip to content

Issue a warning when an implicit view is resolved in -source:3.0-migration #9408

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
adpi2 opened this issue Jul 22, 2020 · 0 comments
Closed
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc compat:scala2 itype:enhancement

Comments

@adpi2
Copy link
Member

adpi2 commented Jul 22, 2020

Minimized example

trait Pretty {
  val print: String
}

object Pretty {
  def pretty[A](a: A)(implicit ev: A => Pretty): String = a.print
}

Output

The above code compiles with -source:3.0-migration but it does not issue a warning. This is an issue because in some cases the code compiles in both migration and standard modes but the runtime behavior is not the same. See below example:

trait Pretty {
  val print: String
}

object Pretty {
  implicit def prettyAny(any: Any): Pretty = new Pretty { val print = "" }
  def pretty[A](a: A)(implicit ev: A => Pretty): String = a.print
}

Expectation

In the migration mode, when an implicit view is resolved a warning should be issued.
The -language:implicitConversions option should not mute this warning.

@smarter smarter added area:reporting Error reporting including formatting, implicit suggestions, etc compat:scala2 itype:enhancement labels Jul 22, 2020
prolativ added a commit to prolativ/dotty that referenced this issue Oct 13, 2020
prolativ added a commit to prolativ/dotty that referenced this issue Oct 13, 2020
prolativ added a commit to prolativ/dotty that referenced this issue Oct 20, 2020
prolativ added a commit to prolativ/dotty that referenced this issue Oct 20, 2020
prolativ added a commit to prolativ/dotty that referenced this issue Oct 21, 2020
prolativ added a commit to prolativ/dotty that referenced this issue Oct 21, 2020
prolativ added a commit to prolativ/dotty that referenced this issue Oct 21, 2020
prolativ added a commit to prolativ/dotty that referenced this issue Oct 21, 2020
prolativ added a commit to prolativ/dotty that referenced this issue Oct 21, 2020
liufengyun added a commit that referenced this issue Oct 21, 2020
…th-migration-flag

Fix #9408: Warn on implicit view resolved with -source:3.0-migration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc compat:scala2 itype:enhancement
Projects
None yet
Development

No branches or pull requests

2 participants