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

No error for ambiguous overloads when the ambiguity involves a default parameter

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Not a Bug
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      object test { 
          def foo(a: Int) = 0; 
          def foo(a: Int, b: Int = 0) = 1 
      }
      defined module test
      test.foo(0)
      res0: Int = 0

      This should provide an error, because the choice of which overload to call is ambiguous.

        Activity

        Hide
        Paul Phillips added a comment -

        This is as specified. "In a method application expression, when multiple overloaded alternatives are applicable, the alternative which use default arguments is never selected."

        Show
        Paul Phillips added a comment - This is as specified. "In a method application expression, when multiple overloaded alternatives are applicable, the alternative which use default arguments is never selected."
        Hide
        Shelby Moore III added a comment - - edited

        Then the specification has a bug.

        How can I trust a compiler that allows me to call ambiguous overloads.

        Tsk. Tsk.

        https://groups.google.com/forum/#!topic/scala-debate/m6QuiSUP43A

        Show
        Shelby Moore III added a comment - - edited Then the specification has a bug. How can I trust a compiler that allows me to call ambiguous overloads. Tsk. Tsk. https://groups.google.com/forum/#!topic/scala-debate/m6QuiSUP43A

          People

          • Assignee:
            Paul Phillips
            Reporter:
            Shelby Moore III
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development