Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dead code in RefChecks #5034

Closed
scabug opened this issue Sep 27, 2011 · 2 comments
Closed

Dead code in RefChecks #5034

scabug opened this issue Sep 27, 2011 · 2 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Sep 27, 2011

{code}new Array(...){code}
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.

@scabug
Copy link
Author

scabug commented Sep 27, 2011

Imported From: https://issues.scala-lang.org/browse/SI-5034?orig=1
Reporter: @soc

@scabug
Copy link
Author

scabug commented Feb 23, 2012

@soc said:
Merged in scala/scala@9f96227

@scabug scabug closed this as completed Feb 23, 2012
@scabug scabug added this to the 2.10.0 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants