aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDmitry Petrashko <dark@d-d.me>2015-07-05 19:23:24 +0200
committerDmitry Petrashko <dark@d-d.me>2015-07-05 19:23:24 +0200
commit6a36dd83e78fe2d6269626480577f8166ab7e37e (patch)
treec6a79e9d2cf89f2d74c4e50abe34d2add54656dd /src
parentfc5cd47d5380d3dc2e4d32a6d9c2eec1fb7cfa4f (diff)
parent8fba722d616618962455d5fe5167e0f6e34817c7 (diff)
downloaddotty-6a36dd83e78fe2d6269626480577f8166ab7e37e.tar.gz
dotty-6a36dd83e78fe2d6269626480577f8166ab7e37e.tar.bz2
dotty-6a36dd83e78fe2d6269626480577f8166ab7e37e.zip
Merge pull request #715 from dotty-staging/repeated-arrays
Fixes to generic arrays in backend.
Diffstat (limited to 'src')
-rw-r--r--src/dotty/runtime/Arrays.scala2
-rw-r--r--src/dotty/tools/backend/jvm/DottyBackendInterface.scala11
2 files changed, 11 insertions, 2 deletions
diff --git a/src/dotty/runtime/Arrays.scala b/src/dotty/runtime/Arrays.scala
index 1fb4fe5eb..4469dced7 100644
--- a/src/dotty/runtime/Arrays.scala
+++ b/src/dotty/runtime/Arrays.scala
@@ -7,6 +7,8 @@ import scala.reflect.ClassTag
*/
object Arrays {
+ // note: this class is magical. Do not touch it unless you know what you are doing.`
+
/** Creates an array of some element type determined by the given `ClassTag`
* argument. The erased type of applications of this method is `Object`.
*/
diff --git a/src/dotty/tools/backend/jvm/DottyBackendInterface.scala b/src/dotty/tools/backend/jvm/DottyBackendInterface.scala
index d7a5c7be0..4a828c5bd 100644
--- a/src/dotty/tools/backend/jvm/DottyBackendInterface.scala
+++ b/src/dotty/tools/backend/jvm/DottyBackendInterface.scala
@@ -157,9 +157,16 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
}.toMap
def unboxMethods: Map[Symbol, Symbol] = defn.ScalaValueClasses.map(x => (x, Erasure.Boxing.unboxMethod(x.asClass))).toMap
- private val mkArrayNames: Set[String] = Set("Byte", "Float", "Char", "Double", "Boolean", "Unit", "Long", "Int", "Short", "Ref")
+ private val mkArrayNames: Set[Name] = Set("Byte", "Float", "Char", "Double", "Boolean", "Unit", "Long", "Int", "Short", "Ref").map{ x=>
+ ("new" + x + "Array").toTermName
+ }
+
+ val dottyArraysModuleClass = toDenot(defn.DottyArraysModule).moduleClass.asClass
- override lazy val syntheticArrayConstructors: Set[Symbol] = mkArrayNames.map(nm => ctx.requiredMethod(toDenot(defn.DottyArraysModule).moduleClass.asClass, s"new${nm}Array"))
+
+ override def isSyntheticArrayConstructor(s: Symbol) = {
+ (toDenot(s).maybeOwner eq dottyArraysModuleClass) && mkArrayNames.contains(s.name)
+ }
def isBox(sym: Symbol): Boolean = Erasure.Boxing.isBox(sym)
def isUnbox(sym: Symbol): Boolean = Erasure.Boxing.isUnbox(sym)