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

Ensure warn-adapted-args works for argument lists other than the last one #8417

Closed
scabug opened this issue Mar 15, 2014 · 4 comments
Closed

Comments

@scabug
Copy link

scabug commented Mar 15, 2014

The "warn-adapted-args" compiler argument only triggers on the last argument list (2.11.0-M7 REPL session):

scala> :settings +Ywarn-adapted-args

scala> def a(x: Any) {
     |     println(x)
     | }
a: (x: Any)Unit

scala> a(1, "String", "Hello")
<console>:9: warning: Adapting argument list by creating a 3-tuple: this may not
 be what you want.
        signature: a(x: Any): Unit
  given arguments: 1, "String", "Hello"
 after adaptation: a((1, "String", "Hello"): (Int, String, String))
              a(1, "String", "Hello")
               ^
(1,String,Hello)

scala> def a2(x: Any)(y: Any) {
     |     println(x)
     | }
a2: (x: Any)(y: Any)Unit

scala> a2(1, "String", "Hello")("World")
(1,String,Hello)

scala> a2(1)("String", "Hello", "World")
<console>:9: warning: Adapting argument list by creating a 3-tuple: this may not
 be what you want.
        signature: a2(x: Any)(y: Any): Unit
  given arguments: "String", "Hello", "World"
 after adaptation: a2(("String", "Hello", "World"): (String, String, String))
              a2(1)("String", "Hello", "World")
                   ^
1

It would be useful if the warning triggered if any of the argument lists in a method declaration requires adaption. See https://groups.google.com/forum/#!topic/scala-language/E-YzZBY9510

Happy to attempt to put together a PR for this, but some pointers as to where to look would be appreciated!

@scabug
Copy link
Author

scabug commented Mar 15, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8417?orig=1
Reporter: @demobox
Affected Versions: 2.11.0-RC1

@scabug
Copy link
Author

scabug commented Mar 8, 2016

@demobox said:
/cc @som-snytt

@scabug
Copy link
Author

scabug commented Jan 16, 2017

@som-snytt said:
scala/scala#5643

@scabug
Copy link
Author

scabug commented Jan 17, 2017

@demobox said (edited on Jan 17, 2017 6:45:14 AM UTC):

scala/scala#5643

Great - many thanks, A.P.!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants