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

Deprecate automatic () insertion #8035

Closed
scabug opened this Issue Dec 5, 2013 · 6 comments

Comments

Projects
None yet
2 participants
@scabug
Copy link

scabug commented Dec 5, 2013

While trying to bridge the gap between tuples and parameter lists, the compiler is a bit too eager to insert 0-Tuples () into argument lists.

This is pretty much never what a developer wants (and we couldn't come up with a single example where the () insertion is “a good thing” in three months), but has been the cause of a lot of embarrassing behavior:

scala> List(1,2,3).toSet()
res0: Boolean = false
import java.text.SimpleDateFormat
val sdf = new SimpleDateFormat("yyyyMMdd-HH0000")
sdf.format()
java.lang.IllegalArgumentException: Cannot format given Object as a Date
  at java.text.DateFormat.format(DateFormat.java:301)
  at java.text.Format.format(Format.java:157)
  ...
scala> class A[T](val x: T)
defined class A

scala> new A
res0: A[Unit] = A@5534578f

Mailing list threads:

https://groups.google.com/forum/#!topic/scala-internals/4RMEZGObPm4
https://groups.google.com/forum/#!topic/scala-user/4yggJc38tIg/discussion
https://groups.google.com/forum/#!topic/scala-debate/zwG8o2YzCWs

@scabug

This comment has been minimized.

Copy link

scabug commented Dec 5, 2013

Imported From: https://issues.scala-lang.org/browse/SI-8035?orig=1
Reporter: @soc
Affected Versions: 2.11.0-M7

@scabug

This comment has been minimized.

Copy link

scabug commented Dec 5, 2013

@retronym said:
I think we should consider this as part of a holistic plan to deprecate autotupling in cases when the expected type was not TupleN.

@scabug

This comment has been minimized.

Copy link

scabug commented Dec 5, 2013

@SethTisue said:
Man. It'd be super great if this finally got addressed.

@scabug

This comment has been minimized.

Copy link

scabug commented Dec 10, 2013

@scabug scabug closed this Jan 15, 2014

@scabug

This comment has been minimized.

Copy link

scabug commented Apr 19, 2014

@Atry said:

import scala.util.control.TailCalls._
def gotWarning: TailRec[Unit] = done()
def noWarning: TailRec[Unit] = done(())

I don't know why scalac warning on done() now.

@scabug

This comment has been minimized.

Copy link

scabug commented Apr 20, 2014

@soc said:
done takes an argument, but you are not providing one in the first example.

@scabug scabug added the critical label Apr 7, 2017

@scabug scabug added this to the 2.11.0-M8 milestone Apr 7, 2017

eed3si9n added a commit to eed3si9n/scala that referenced this issue Jun 16, 2018

Remove adaptation of 0-arg methods under -Xsource:3.0
Get thee to a nullary, go. Farewell -Xfuture.

Ref scala/bug#8035

som-snytt added a commit to som-snytt/scala that referenced this issue Jul 25, 2018

Remove adaptation of 0-arg methods under -Xsource:3.0
Get thee to a nullary, go. Farewell -Xfuture.

Ref scala/bug#8035

som-snytt added a commit to som-snytt/scala that referenced this issue Jul 28, 2018

Remove adaptation of 0-arg methods under -Xsource:3.0
Get thee to a nullary, go. Farewell -Xfuture.

Ref scala/bug#8035

som-snytt added a commit to som-snytt/scala that referenced this issue Jul 28, 2018

Remove adaptation of 0-arg methods under -Xsource:3.0
Get thee to a nullary, go. Farewell -Xfuture.

Ref scala/bug#8035

som-snytt added a commit to som-snytt/scala that referenced this issue Aug 7, 2018

Remove adaptation of 0-arg methods under -Xsource:3.0
Get thee to a nullary, go. Farewell -Xfuture.

Ref scala/bug#8035
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment