summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2012-06-27 11:14:24 +0200
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-06-27 12:12:40 +0200
commit22834ee32e8471a8ab33e194d7469686d60ef7d5 (patch)
treee6094cd08646d5ddb9901c9af20a6cad3b18fb3c /test/files/run
parent966c9bbebec78b90a79f72c73b55d9de6db34798 (diff)
downloadscala-22834ee32e8471a8ab33e194d7469686d60ef7d5.tar.gz
scala-22834ee32e8471a8ab33e194d7469686d60ef7d5.tar.bz2
scala-22834ee32e8471a8ab33e194d7469686d60ef7d5.zip
make tests independent of compiler api
TODO: t5899 should also be refactored, but I couldn't figure out how I tried the obvious Cake Light pattern with abstract types etc, but that didn't trigger it there must be something with indirection through paths as well
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/t5914.scala26
1 files changed, 20 insertions, 6 deletions
diff --git a/test/files/run/t5914.scala b/test/files/run/t5914.scala
index 53cae9be74..45d8815738 100644
--- a/test/files/run/t5914.scala
+++ b/test/files/run/t5914.scala
@@ -1,9 +1,23 @@
-import scala.reflect.runtime.universe._
+import scala.reflect.ClassTag
-object Test extends App {
- val tree: Tree = null
- tree match {
- case TypeTree() => println("lolwut")
- case null => println("correct")
+trait Trees {
+ class Tree
+ implicit val ttTag: ClassTag[TypeTree]
+ type TypeTree <: Tree
+ val TypeTree: TypeTreeExtractor
+ abstract class TypeTreeExtractor {
+ def unapply(t: TypeTree): Option[String]
}
+ def test(tree: Tree) =
+ tree match {
+ case TypeTree(_) => println("lolwut")
+ case null => println("correct")
+ }
+}
+
+object Test extends App with Trees {
+ val ttTag = implicitly[ClassTag[TypeTree]]
+ case class TypeTree(meh: String) extends Tree
+ object TypeTree extends TypeTreeExtractor
+ test(null) // should not crash
} \ No newline at end of file