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

Overloaded extension methods with context parameters cannot be fully constructed #8188

Closed
nicolasstucki opened this issue Feb 4, 2020 · 0 comments · Fixed by #8245
Closed

Comments

@nicolasstucki
Copy link
Contributor

minimized code

object Test {
  extension StrDeco on (tree: String) {
    def show(given DummyImplicit): String = ???
    def show(color: Boolean)(given DummyImplicit): String = ???
  }

  val a: String = "foo".show
  val b: String = "foo".show(true)
  val c: Any = "foo".show
  val d: Any = "foo".show(true)
}

Compilation output

11 |  val c: Any = "foo".show
   |               ^^^^^^^^^^
   |      value show is not a member of String.
   |      An extension method was tried, but could not be fully constructed:
   |
   |          Test.StrDeco.show("foo")

expectation

It should compile

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Feb 4, 2020
Workaround scala#8188 by renaming on of the `show` to `showWith`
@anatoliykmetyuk anatoliykmetyuk self-assigned this Feb 4, 2020
anatoliykmetyuk added a commit to dotty-staging/dotty that referenced this issue Feb 7, 2020
anatoliykmetyuk added a commit to dotty-staging/dotty that referenced this issue Feb 10, 2020
anatoliykmetyuk added a commit to dotty-staging/dotty that referenced this issue Feb 18, 2020
anatoliykmetyuk added a commit to dotty-staging/dotty that referenced this issue Mar 3, 2020
odersky added a commit that referenced this issue Mar 4, 2020
Fix #8188: For the purposes of overloading, contextual methods aren't methodic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants