Details

    • Type: Bug
    • Status: CLOSED
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: Scala 2.11.0-M7
    • Fix Version/s: Scala 2.11.0-M8
    • Component/s: Compiler (Misc)
    • Labels:
      None

      Description

      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

        Attachments

          Issue Links

            Activity

            Hide
            retronym Jason Zaugg added a comment -

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

            Show
            retronym Jason Zaugg added a comment - I think we should consider this as part of a holistic plan to deprecate autotupling in cases when the expected type was not TupleN.
            Hide
            sethtisue Seth Tisue added a comment -

            Man. It'd be super great if this finally got addressed.

            Show
            sethtisue Seth Tisue added a comment - Man. It'd be super great if this finally got addressed.
            Show
            soc Simon Ochsenreither added a comment - PR: https://github.com/scala/scala/pull/3260
            Hide
            atry 杨博 added a comment -

            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.

            Show
            atry 杨博 added a comment - 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.
            Hide
            soc Simon Ochsenreither added a comment -

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

            Show
            soc Simon Ochsenreither added a comment - done takes an argument, but you are not providing one in the first example.

              People

              • Assignee:
                soc Simon Ochsenreither
                Reporter:
                soc Simon Ochsenreither
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: