Skip to content
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

ExplicitResultTypes don't rewrite implicit members of local traits #1180

Closed
ohze opened this issue Jun 27, 2020 · 1 comment · Fixed by #1181
Closed

ExplicitResultTypes don't rewrite implicit members of local traits #1180

ohze opened this issue Jun 27, 2020 · 1 comment · Fixed by #1181

Comments

@ohze
Copy link

ohze commented Jun 27, 2020

Input

/*
rule = ExplicitResultTypes
ExplicitResultTypes.skipLocalImplicits = false
*/
package test.explicitResultTypes

class ExplicitImplicitTypesTest {
  trait T
  def f(): T = new T {
    implicit val i = 1
  }
  def g(): Unit = {
    class C {
      implicit val i = 1
    }
  }
}

Output

Two implicit val i = 1 above are not rewritten.

Expectation

Should rewrite to implicit val i: Int = 1 because the code above don't compile in dotty.

I test with dotty 0.24.0 and 0.25.0-RC2 => error: type of implicit definition needs to be given explicitly.

@giabao
Copy link
Contributor

giabao commented Jun 27, 2020

In fact, skipLocalImplicits = false config has no effect. ExplicitResultTypes still do not rewrite the following code:

class C {
  def g(): Unit = {
    implicit val i = 1
  }
}

giabao added a commit to giabao/scalafix that referenced this issue Jun 27, 2020
giabao added a commit to ohze/scalafix-rules that referenced this issue Jun 27, 2020
mlachkar added a commit that referenced this issue Jul 2, 2020
Fix #1180 - ExplicitResultTypes for implicit members of local traits
mlachkar pushed a commit to mlachkar/scalafix that referenced this issue Jul 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants