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

patmat: not enough arguments for method body%41

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: Scala 2.9.0
    • Fix Version/s: Scala 2.10.0
    • Component/s: Repl / Interpreter
    • Labels:
      None
    • Environment:

      Scala version 2.9.0.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_24)
      Linux 2.6.36-gentoo-r5 #1 SMP PREEMPT Tue Feb 22 14:06:07 CET 2011 x86_64 Intel(R) Core(TM)2 CPU 4300 @ 1.80GHz GenuineIntel GNU/Linux

      Description

      Pasting the following snippet into the interpreter leads to a crash of the interpreter:

       
      def analyze(x: Any) = x match {
        case s: String => println("It's a string: " + s)
        case 1 => println("It's a one")
        case (a: Int, b) => println("It's a pair of and int " + a +
                                    " and something " + b)
        case 1 :: 2 :: _ => println("It's a list starting with 1, 2")
        case List(a, b, c) => println("It's a three-element list with " +
                                      a + ", " + b + ", " + c)
        case _ => println("It's something different")
      }
      

      Here's the beginning of the interpreter's output:

       
      <console>:13: warning: No binding
               case List(a, b, c) => println("It's a three-element list with " +
                         ^
      <console>:13: warning: No binding
               case List(a, b, c) => println("It's a three-element list with " +
                            ^
      <console>:13: warning: No binding
               case List(a, b, c) => println("It's a three-element list with " +
                               ^
      scala.tools.nsc.symtab.Types$TypeError: not enough arguments for method body%41: (val a: A, val b: A, val c: A)Unit.
      Unspecified value parameters a, b, c.
              at scala.tools.nsc.typechecker.Contexts$Context.error(Contexts.scala:291)
              at scala.tools.nsc.typechecker.Infer$Inferencer.error(Infer.scala:205)
              at scala.tools.nsc.typechecker.Infer$Inferencer.errorTree(Infer.scala:209)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$tryNamesDefaults$1$4.apply(Typers.scala:2395)
              at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$tryNamesDefaults$1$4.apply(Typers.scala:2395)
              at scala.Option.getOrElse(Option.scala:109)
              at scala.tools.nsc.typechecker.Typers$Typer.tryNamesDefaults$1(Typers.scala:2395)
              at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:2405)
              at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:3344)
              at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4062)
              at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4217)
      

        Activity

        Show
        Simon Ochsenreither added a comment - Fixed in https://github.com/scala/scala/commit/4c04213b991596aa73dec3aa34cb8816a277f538

          People

          • Assignee:
            Paul Phillips
            Reporter:
            Stefan Wehr
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development