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

SI-8035 Deprecate automatic () insertion in argument lists #3260

Merged
merged 1 commit into from Jan 15, 2014

Conversation

Projects
None yet
5 participants
@soc
Copy link
Member

soc commented Dec 10, 2013

This promotes the () insertion warning from -Ywarn-adapted-args to a
deprecation warning. -Xfuture tunrs it into a compiler error.

Auto tupling remains unchanged for now.

The tests have been fixed the following way:

  • Warnings caused by general sloppiness (Try(), Future(), ...) have been
    fixed.
  • Warnings which raise interesting questions (x == (), ...) received an
    updated checkfile for now.
@retronym

View changes

src/compiler/scala/tools/nsc/typechecker/Adaptations.scala Outdated
context.warning(t.pos, adaptWarningMessage("No automatic adaptation here: use explicit parentheses."))
else if (args.isEmpty) {
if (settings.future)
context.error(t.pos, adaptWarningMessage("Adaption of argument list by inserting () has been removed.", showAdaption = false))

This comment has been minimized.

@retronym

retronym Dec 10, 2013

Member

s/Adaption/Adaptation/

@soc

This comment has been minimized.

Copy link
Member Author

soc commented Dec 10, 2013

@retronym Fixed.

@retronym

This comment has been minimized.

Copy link
Member

retronym commented Dec 10, 2013

Could you please summarize the change in the commit message? (e.g. "it used to incur a warning under -Y...; now we promote the case of ()-insertion to a deprecation (or an error under -Xfuture); tupling of other arities remains unchanged for now.")

@soc

This comment has been minimized.

Copy link
Member Author

soc commented Dec 10, 2013

@retronym Done.

@soc

This comment has been minimized.

Copy link
Member Author

soc commented Dec 11, 2013

Review by @retronym, please!

@ghost ghost assigned retronym Dec 13, 2013

@xeno-by

This comment has been minimized.

Copy link
Member

xeno-by commented Dec 21, 2013

@soc Needs a rebase

@soc

This comment has been minimized.

Copy link
Member Author

soc commented Dec 21, 2013

@xeno-by Done.

SI-8035 Deprecate automatic () insertion in argument lists
This promotes the () insertion warning from -Ywarn-adapted-args to a
deprecation warning. -Xfuture tunrs it into a compiler error.

Auto tupling remains unchanged for now.

The tests have been fixed the following way:
- Warnings caused by general sloppiness (Try(), Future(), ...) have been
  fixed.
- Warnings which raise interesting questions (x == (), ...) received an
  updated checkfile for now.
@adriaanm

This comment has been minimized.

Copy link
Member

adriaanm commented Jan 14, 2014

LGTM

adriaanm added a commit that referenced this pull request Jan 15, 2014

Merge pull request #3260 from soc/SI-8035
 Deprecate automatic () insertion in argument lists

@adriaanm adriaanm merged commit 0e89841 into scala:master Jan 15, 2014

1 check passed

default pr-scala Took 69 min.
Details

kiritsuku added a commit to kiritsuku/scala-ide that referenced this pull request Jan 21, 2014

Fix warning about adapted argument list
This warning became an error in 2.11 since scala/scala#3260, when
-Xfuture is enabled.

@adriaanm adriaanm referenced this pull request Feb 5, 2014

Closed

Fix compilation errors #3472

@sief

This comment has been minimized.

Copy link

sief commented Jun 10, 2014

I get the deprecation warning in the following snippet:

scala> def f(f1: Unit => Unit) {f1()}
:7: warning: Adaptation of argument list by inserting () has been deprecated: this is unlikely to be what you want.

If I omit the parentheses I get a different warning which makes sense, I need the parentheses in order to execute f1. Am I missing something here?

@retronym

This comment has been minimized.

Copy link
Member

retronym commented Jun 10, 2014

scala> def f(f1: Unit => Unit) {f1()}
<console>:7: warning: Adaptation of argument list by inserting () has been deprecated: this is unlikely to be what you want.
        signature: Function1.apply(v1: T1): R
  given arguments: <none>
 after adaptation: Function1((): Unit)
       def f(f1: Unit => Unit) {f1()}
                                  ^
f: (f1: Unit => Unit)Unit

scala> def f(f1: Unit => Unit) {f1(())}
f: (f1: Unit => Unit)Unit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment