summaryrefslogtreecommitdiff
path: root/test/files/jvm/manifests.scala
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-04-12 01:59:46 +0200
committerEugene Burmako <xeno.by@gmail.com>2012-04-12 02:04:14 +0200
commit814cf34fb00f9ccb001249f4b3445ebc4f9942c9 (patch)
tree24dd54da571d27f10b0c482a6e08932c318fd7b2 /test/files/jvm/manifests.scala
parentdb3056f11730da19e4e56f09f12e300bda62f57c (diff)
downloadscala-814cf34fb00f9ccb001249f4b3445ebc4f9942c9.tar.gz
scala-814cf34fb00f9ccb001249f4b3445ebc4f9942c9.tar.bz2
scala-814cf34fb00f9ccb001249f4b3445ebc4f9942c9.zip
Next generation of macros
Implements SIP 16: Self-cleaning macros: http://bit.ly/wjjXTZ Features: * Macro defs * Reification * Type tags * Manifests aliased to type tags * Extended reflection API * Several hundred tests * 1111 changed files Not yet implemented: * Reification of refined types * Expr.value splicing * Named and default macro expansions * Intricacies of interaction between macros and implicits * Emission of debug information for macros (compliant with JSR-45) Dedicated to Yuri Alekseyevich Gagarin
Diffstat (limited to 'test/files/jvm/manifests.scala')
-rw-r--r--test/files/jvm/manifests.scala119
1 files changed, 0 insertions, 119 deletions
diff --git a/test/files/jvm/manifests.scala b/test/files/jvm/manifests.scala
deleted file mode 100644
index 6bbea4d052..0000000000
--- a/test/files/jvm/manifests.scala
+++ /dev/null
@@ -1,119 +0,0 @@
-object Test extends App {
- Test1
- Test2
- //Test3 // Java 1.5+ only
-}
-
-class Foo[T](x: T)
-trait Bar[T] { def f: T }
-
-object Test1 extends TestUtil {
- print(())
- print(true)
- print('a')
- print(1)
- print("abc")
- print('abc)
- println()
-
- print(List(()))
- print(List(true))
- print(List(1))
- print(List("abc"))
- print(List('abc))
- println()
-
- //print(Array(())) //Illegal class name "[V" in class file Test$
- print(Array(true))
- print(Array('a'))
- print(Array(1))
- print(Array("abc"))
- print(Array('abc))
- println()
-
- print(((), ()))
- print((true, false))
- print((1, 2))
- print(("abc", "xyz"))
- print(('abc, 'xyz))
- println()
-
- // Disabled: should these work? changing the inference for objects from
- // "object Test" to "Test.type" drags in a singleton manifest which for
- // some reason leads to serialization failure.
- // print(Test)
- // print(List)
- println()
-
- print(new Foo(2))
- print(new Foo(List(2)))
- print(new Foo(new Foo(2)))
- print(new Foo(List(new Foo(2))))
- println()
-
- print(new Bar[String] { def f = "abc" })
- println()
-}
-
-object Test2 {
- import scala.util.Marshal._
- println("()="+load[Unit](dump(())))
- println("true="+load[Boolean](dump(true)))
- println("a="+load[Char](dump('a')))
- println("1="+load[Int](dump(1)))
- println("'abc="+load[Symbol](dump('abc)))
- println()
-
- println("List(())="+load[List[Unit]](dump(List(()))))
- println("List(true)="+load[List[Boolean]](dump(List(true))))
- println("List('abc)="+load[List[Symbol]](dump(List('abc))))
- println()
-
- def loadArray[T](x: Array[Byte])(implicit m: reflect.Manifest[Array[T]]) =
- load[Array[T]](x)(m).deep.toString
- println("Array()="+loadArray[Int](dump(Array(): Array[Int])))
- println("Array(true)="+loadArray[Boolean](dump(Array(true))))
- println("Array(a)="+loadArray[Char](dump(Array('a'))))
- println("Array(1)="+loadArray[Int](dump(Array(1))))
- println()
-
- println("((),())="+load[(Unit, Unit)](dump(((), ()))))
- println("(true,false)="+load[(Boolean, Boolean)](dump((true, false))))
- println()
-
- println("List(List(1), List(2))="+load[List[List[Int]]](dump(List(List(1), List(2)))))
- println()
-
- println("Array(Array(1), Array(2))="+loadArray[Array[Int]](dump(Array(Array(1), Array(2)))))
- println()
-}
-
-object Test3 extends TestUtil {
- import scala.reflect.Manifest._
- val ct1 = classType(classOf[Char])
- val ct2 = classType(classOf[List[_]], ct1)
- print(ct1)
- //print(ct2) // ??? x=scala.List[char], m=scala.reflect.Manifest[scala.runtime.Nothing$]
- println()
-}
-
-trait TestUtil {
- import java.io._
- def write[A](o: A): Array[Byte] = {
- val ba = new ByteArrayOutputStream(512)
- val out = new ObjectOutputStream(ba)
- out.writeObject(o)
- out.close()
- ba.toByteArray()
- }
- def read[A](buffer: Array[Byte]): A = {
- val in = new ObjectInputStream(new ByteArrayInputStream(buffer))
- in.readObject().asInstanceOf[A]
- }
- import scala.reflect._
- def print[T](x: T)(implicit m: Manifest[T]) {
- val m1: Manifest[T] = read(write(m))
- val x1 = x.toString.replaceAll("@[0-9a-z]+$", "")
- println("x="+x1+", m="+m1)
- }
-}