diff options
author | Martin Odersky <odersky@gmail.com> | 2014-11-28 22:10:37 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-11-28 22:12:51 +0100 |
commit | 91c61e4694097971b9a0c139048b7239d0f05588 (patch) | |
tree | 6836b169dce43f32e588f60bb16d14dba850b254 /src/dotty/runtime | |
parent | b18ce863f5f2444a5a00ccc9d55c4ee12115c467 (diff) | |
download | dotty-91c61e4694097971b9a0c139048b7239d0f05588.tar.gz dotty-91c61e4694097971b9a0c139048b7239d0f05588.tar.bz2 dotty-91c61e4694097971b9a0c139048b7239d0f05588.zip |
Previous scheme was buggy; leaked Array types to backend.
Now: All new Array[T] methods are translated to calls of the form
dotty.Arrays.newXYZArray ...
Diffstat (limited to 'src/dotty/runtime')
-rw-r--r-- | src/dotty/runtime/Arrays.scala | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/dotty/runtime/Arrays.scala b/src/dotty/runtime/Arrays.scala new file mode 100644 index 000000000..e7f819df8 --- /dev/null +++ b/src/dotty/runtime/Arrays.scala @@ -0,0 +1,47 @@ +package dotty.runtime + +import scala.reflect.ClassTag + +/** All but the first operation should be short-circuited and implemented specially by + * the backend. + */ +object Arrays { + + /** Creates an array of some element type determined by the given `ClassTag` + * argument. The erased type of applications of this method is `Object`. + */ + def newGenericArray[T](length: Int)(implicit tag: ClassTag[T]): Array[T] = + tag.newArray(length) + + /** Create an array of type T. T must be of form Array[E], with + * E being a reference type. + */ + def newRefArray[T](length: Int): T = ??? + + /** Create a Byte[] array */ + def newByteArray(length: Int): Array[Byte] = ??? + + /** Create a Short[] array */ + def newShortArray(length: Int): Array[Short] = ??? + + /** Create a Char[] array */ + def newCharArray(length: Int): Array[Char] = ??? + + /** Create an Int[] array */ + def newIntArray(length: Int): Array[Int] = ??? + + /** Create a Long[] array */ + def newLongArray(length: Int): Array[Long] = ??? + + /** Create a Float[] array */ + def newFloatArray(length: Int): Array[Float] = ??? + + /** Create a Double[] array */ + def newDoubleArray(length: Int): Array[Double] = ??? + + /** Create a Boolean[] array */ + def newBooleanArray(length: Int): Array[Boolean] = ??? + + /** Create a scala.runtime.BoxedUnit[] array */ + def newUnitArray(length: Int): Array[Unit] = ??? +}
\ No newline at end of file |