Skip to content

Extension methods don't get eta-expanded #10391

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
prolativ opened this issue Nov 19, 2020 · 0 comments · Fixed by #10902
Closed

Extension methods don't get eta-expanded #10391

prolativ opened this issue Nov 19, 2020 · 0 comments · Fixed by #10902
Milestone

Comments

@prolativ
Copy link
Contributor

Minimized code

extension (s: String) def x(i: Int): Int = i

val x = "".x

Output

value x is not a member of String.
An extension method was tried, but could not be fully constructed:
    {
      def $anonfun(i: Int): Int = x("")(i)
      closure($anonfun)
    }

Expectation

"".x should evaluate into a lambda just like it works for old style extensions using implicit classes:

implicit class StrOps(s: String) {
  def x(i: Int): Int = i
}

val x = "".x

results with

val x: Int => Int = Lambda$1578/0x00000008011a0040@71897380
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.

2 participants