From 22834ee32e8471a8ab33e194d7469686d60ef7d5 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Wed, 27 Jun 2012 11:14:24 +0200 Subject: 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 --- test/files/run/t5914.scala | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'test/files/run') 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 -- cgit v1.2.3