Uploaded image for project: 'Scala Programming Language'
  1. Scala Programming Language
  2. SI-4592

Unexpected error when combining default parameters, named arguments, currying, and parameterized type

    Details

    • Type: Bug
    • Status: CLOSED
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Compiler (Misc)
    • Labels:
      None

      Description

      This seems related to SI-4591

      object Control {
        def repeat[T](count: Int = 1, x: Boolean = true)(thunk: => T) : T = (0 until count).map(_ => thunk).last
        def repeat[T](thunk: => T) : T = repeat()(thunk)
       
        repeat(3.14)
        repeat(count=5)(3.14)
        repeat(count=5,x=false)(3.14)
      }

      === What is the expected behavior? ===

      No error when compiling.

      === What do you see instead? ===

       scalac repeat.scala 
      repeat.scala:8: error: not found: value count
        repeat(count=5)(3.14)
               ^
      one error found

      Interestingly, in SI-4591 (which is similar code except the the use of type parameter), the error location is the definition itself (and not usage). Error message is confusing in any case.

      === Additional information ===
      (for instance, a link to a relevant mailing list discussion)

      === What versions of the following are you using? ===

      • Scala: 2.9.final
      • Java: 1.6
      • Operating system: MacOS Snow Leopard

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                extempore Paul Phillips
                Reporter:
                ramnivas Ramnivas Laddad
                TracCC:
                Ismael Juma
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: