Scala Programming Language
  1. Scala Programming Language
  2. SI-5067

Incorrect error message for methods taking tuples as arguments

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: Scala 2.9.1
    • Fix Version/s: None
    • Component/s: Misc Compiler
    • Labels:
      None

      Description

      Given the following (incorrect) class:

      class Foo extends Function2[Int, Int, Int] {
        def apply(x: Int, y: Int) = x + y
        override def tupled: (Int, Int) => Int = super.tupled
      }
      

      The 2.9.1 generates the following incorrect and confusing error message:

      [error] /Users/paul/scala/foo/src/main/scala/Foo.scala:5: type mismatch;
      [error]  found   : (Int, Int) => Int
      [error]  required: (Int, Int) => Int
      [error]   override def tupled: (Int, Int) => Int = super.tupled
      [error]                                                  ^
      

      This is a regression from 2.9.0, which generates:

      [error] /Users/paul/scala/foo/src/main/scala/Foo.scala:5: type mismatch;
      [error]  found   : ((Int, Int)) => Int
      [error]  required: (Int, Int) => Int
      [error]   override def tupled: (Int, Int) => Int = super.tupled
      [error]                                                  ^
      [error] one error found
      

      An SBT project that demonstrates this issue is checked into GitHub. See the correct error message with ++ 2.9.0 compile and the incorrect one with ++ 2.9.1 compile.

        Activity

        Hide
        Commit Message Bot added a comment -

        (extempore in r25808) Fix for error printing regression.

        One's devotion to aesthetics must not be allowed to trump one's
        commitment to clearly delineated tuplehood. Closes SI-5067, no review.

        Show
        Commit Message Bot added a comment - (extempore in r25808 ) Fix for error printing regression. One's devotion to aesthetics must not be allowed to trump one's commitment to clearly delineated tuplehood. Closes SI-5067 , no review.
        Hide
        Paul Butcher added a comment -

        Many thanks for the rapid turnaround, Paul!

        Show
        Paul Butcher added a comment - Many thanks for the rapid turnaround, Paul!

          People

          • Assignee:
            Paul Phillips
            Reporter:
            Paul Butcher
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development