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 can't be used for implicit extension method if original type has same-named method #7809
Comments
Imported From: https://issues.scala-lang.org/browse/SI-7809?orig=1 |
Justin Bailey (m4dc4p) said (edited on Mar 25, 2017 8:43:54 PM UTC): case class AuthorizationRequest(
val sid: String,
val oid: Option[String],
val o_class: Option[String],
val act: Option[String],
val ctx: Option[String]
)
trait AuthorizationClient {
def authorize(req: AuthorizationRequest): Task[Unit]
}
object AuthorizationClient {
implicit class AuthorizationExts(client: AuthorizationClient) {
def authorize(sid: String, oid: String = null, o_class: String = null, act: String = null, ctx: Json = null) = {
client.authorize(AuthorizationRequest(sid = sid, oid = Option(oid), o_class = Option(o_class), act = Option(action), ctx = Option(ctx)))
}
}
} The intermediate auth.authorize(sid ="foo", oid = "bar", o_class = "bif", etc.) This also makes it impossible to omit parameters and use defaults instead. Self-contained example in my next comment. |
Justin Bailey (m4dc4p) said (edited on Mar 25, 2017 8:50:12 PM UTC): object S {
class Test {
def test(arg: Int) = ???
}
class ExtClass(f: Test) {
def test(arg: String) = ???
}
implicit final def Implicit(t: Test) = new ExtClass(t)
(new Test).test("works")
(new Test).test(arg = "fails")
} Note that I ran with no second try: (arg: Int)Nothing and arg = "fails" because error not in result: source-C:\Users\Justin\Source\SI-7809\S.scala,line-13,offset=246!=source-C:\Users\Justin\Source\SI-7809\S.scala,line-13,offset=239 This is the full typer-debug output for
And this is from
|
Justin Bailey (m4dc4p) said (edited on Apr 3, 2017 6:48:07 PM UTC): Filtering out the AssignOrNamedArg to the PR in progress at scala/scala#5807. |
Justin Bailey (m4dc4p) said: |
This bug is not a quick fix :( |
Progressed to "unknown parameter name". |
The text was updated successfully, but these errors were encountered: