Skip to content

Commit b8ac8bd

Browse files
committed
Arrays.newRefArray has multiple symbols that coexist during bootstrap.
More magic is needed, as enumerating array symbols does not work in backend.
1 parent d3819ce commit b8ac8bd

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

project/Build.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ object DottyBuild extends Build {
4242
resolvers += Resolver.sonatypeRepo("releases"),
4343

4444
// get libraries onboard
45-
partestDeps := Seq("me.d-d" % "scala-compiler" % "2.11.5-20150506-175515-8fc7635b56",
45+
partestDeps := Seq("me.d-d" % "scala-compiler" % "2.11.5-20150619-173733-3bcd390afa",
4646
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
4747
"org.scala-lang" % "scala-library" % scalaVersion.value % "test"),
4848
libraryDependencies ++= partestDeps.value,

src/dotty/runtime/Arrays.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import scala.reflect.ClassTag
77
*/
88
object Arrays {
99

10+
// note: this class is magical. Do not touch it unless you know what you are doing.`
11+
1012
/** Creates an array of some element type determined by the given `ClassTag`
1113
* argument. The erased type of applications of this method is `Object`.
1214
*/

src/dotty/tools/backend/jvm/DottyBackendInterface.scala

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,16 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
157157
}.toMap
158158
def unboxMethods: Map[Symbol, Symbol] = defn.ScalaValueClasses.map(x => (x, Erasure.Boxing.unboxMethod(x.asClass))).toMap
159159

160-
private val mkArrayNames: Set[String] = Set("Byte", "Float", "Char", "Double", "Boolean", "Unit", "Long", "Int", "Short", "Ref")
160+
private val mkArrayNames: Set[Name] = Set("Byte", "Float", "Char", "Double", "Boolean", "Unit", "Long", "Int", "Short", "Ref").map{ x=>
161+
("new" + x + "Array").toTermName
162+
}
163+
164+
val dottyArraysModuleClass = toDenot(defn.DottyArraysModule).moduleClass.asClass
161165

162-
override lazy val syntheticArrayConstructors: Set[Symbol] = mkArrayNames.map(nm => ctx.requiredMethod(toDenot(defn.DottyArraysModule).moduleClass.asClass, s"new${nm}Array"))
166+
167+
override def isSyntheticArrayConstructor(s: Symbol) = {
168+
toDenot(s).maybeOwner eq dottyArraysModuleClass && mkArrayNames.contains(s.name)
169+
}
163170

164171
def isBox(sym: Symbol): Boolean = Erasure.Boxing.isBox(sym)
165172
def isUnbox(sym: Symbol): Boolean = Erasure.Boxing.isUnbox(sym)

0 commit comments

Comments
 (0)