Details

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

      2.10.0.r25726-b20110927020209 (OpenJDK 64-Bit Server VM, Java 1.6.0_22)

      Description

      new Array(...)

      with more than one dimension is not supported anymore:

      new Array(1,1)
      error: too many arguments for constructor Array: (_length: Int)Array[T]
                    new Array(1,1)
                    ^
      

      But RefChecks still checks for it:

            case Apply(Select(New(tpt), name), args) 
            if (tpt.tpe.typeSymbol == ArrayClass && args.length >= 2) =>
              unit.deprecationWarning(tree.pos, 
                "new Array(...) with multiple dimensions has been deprecated; use Array.ofDim(...) instead")
              val manif = {
                var etpe = tpt.tpe
                for (_ <- args) { etpe = etpe.typeArgs.headOption.getOrElse(NoType) }
                if (etpe == NoType) {
                  unit.error(tree.pos, "too many dimensions for array creation")
                  Literal(Constant(null))
                } else {
                  localTyper.getManifestTree(tree.pos, etpe, false)
                }
              }
              val newResult = localTyper.typedPos(tree.pos) {
                new ApplyToImplicitArgs(gen.mkMethodCall(ArrayModule, nme.ofDim, args), List(manif))
              }
              currentApplication = tree
              newResult
      

      This looks like dead code to me.

        Activity

        Show
        Simon Ochsenreither added a comment - Merged in https://github.com/scala/scala/commit/9f96227ed9dd25cbcb754fc8cbb1013d4e48badf

          People

          • Assignee:
            Paul Phillips
            Reporter:
            Simon Ochsenreither
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development