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

Named Arguments & Implicits #5807

Closed
wants to merge 3 commits into from
Closed

Conversation

m4dc4p
Copy link

@m4dc4p m4dc4p commented Mar 27, 2017

Fixes a bug where implicit definition is not resolved when using named arguments at call site. (https://issues.scala-lang.org/browse/SI-7809)

Updates README with info on using SBT_OPTS to increase JVM heap size if OOM occurs.

@scala-jenkins scala-jenkins added this to the 2.12.2 milestone Mar 27, 2017
@m4dc4p
Copy link
Author

m4dc4p commented Mar 27, 2017

CLA signed.

@m4dc4p
Copy link
Author

m4dc4p commented Mar 27, 2017

@SethTisue

@adriaanm adriaanm added the welcome hello new contributor! label Mar 28, 2017
Copy link
Member

@lrytz lrytz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi & welcome!

This is going to be more complicated, unfortunately.. Simply removing the argument names leads to unexpected / wrong results.

class Test {
  def m(a: Int) = 0
}

object A extends App {
  implicit class Ext(val f: Test) {
    def m(notMyName: String) = 1
  }
  assert((new Test).m("works") == 1)
  assert((new Test).m(a = "compiles") == 1) // weird, there's no parameter named `a` in the selected method
}

object B extends App {
  implicit class Ext(val f: Test) {
    def m(a: Int, b: Int) = a - b
  }
  assert((new Test).m(b = 5, a = 10) == 5) // ups...
}

Note: If compilation fails with "Out of Memory" errors, try increasing the heap
size:

$ SBT_OPTS=-Xmx8192M
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value is really big, 1536m is good enough. Also, we should mention here again that we recommend https://github.com/paulp/sbt-extras, which sets -Xmx1536m by default. So it could be something like:

Note: If compilation fails with "Out of Memory" errors, set SBT_OPTS=-Xmx1536m, or use sbt-extras (recommended) which defines this setting by default.

Feel free to submit this as a separate PR.

@m4dc4p
Copy link
Author

m4dc4p commented Apr 3, 2017

Excellent counter-example, thanks for looking.

@m4dc4p
Copy link
Author

m4dc4p commented Apr 4, 2017

@lrytz Can I rebase and force push this PR, or is it better to close and create a new branch?

@SethTisue
Copy link
Member

rebasing and force-pushing is totally fine, that's usually how we work

@SethTisue
Copy link
Member

closing for inactivity. we can reopen it if activity resumes

@SethTisue SethTisue closed this Feb 24, 2018
@SethTisue SethTisue removed this from the WIP milestone Mar 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
welcome hello new contributor!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants