-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Conversation
CLA signed. |
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
Excellent counter-example, thanks for looking. |
@lrytz Can I rebase and force push this PR, or is it better to close and create a new branch? |
rebasing and force-pushing is totally fine, that's usually how we work |
closing for inactivity. we can reopen it if activity resumes |
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.