summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-10-29 19:34:54 +0000
committerPaul Phillips <paulp@improving.org>2011-10-29 19:34:54 +0000
commit48a26b9c2be3cb5390dafa8a13620c91fab0167d (patch)
treeb844c9eaac6d5deabb975d5627e52e1fd589f873
parentd1f89f473a004faf6bb934196d5e44447102bf2c (diff)
downloadscala-48a26b9c2be3cb5390dafa8a13620c91fab0167d.tar.gz
scala-48a26b9c2be3cb5390dafa8a13620c91fab0167d.tar.bz2
scala-48a26b9c2be3cb5390dafa8a13620c91fab0167d.zip
Test case closes SI-4875.
No review.
-rw-r--r--src/library/scala/reflect/Code.scala1
-rw-r--r--test/files/run/t4875.check17
-rw-r--r--test/files/run/t4875.scala12
3 files changed, 30 insertions, 0 deletions
diff --git a/src/library/scala/reflect/Code.scala b/src/library/scala/reflect/Code.scala
index ba9e9e33d5..65954c7970 100644
--- a/src/library/scala/reflect/Code.scala
+++ b/src/library/scala/reflect/Code.scala
@@ -13,6 +13,7 @@ package scala.reflect
/** This type is required by the compiler and <b>should not be used in client code</b>. */
class Code[T: Manifest](val tree: scala.reflect.mirror.Tree) {
val manifest = implicitly[Manifest[T]]
+ override def toString = "Code(manifest = " + manifest + ")"
}
/** This type is required by the compiler and <b>should not be used in client code</b>. */
diff --git a/test/files/run/t4875.check b/test/files/run/t4875.check
new file mode 100644
index 0000000000..05a398593c
--- /dev/null
+++ b/test/files/run/t4875.check
@@ -0,0 +1,17 @@
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala>
+
+scala> import scala.reflect.Code
+import scala.reflect.Code
+
+scala> def codeOf[A](code: Code[A]) = code
+codeOf: [A](code: scala.reflect.Code[A])scala.reflect.Code[A]
+
+scala> codeOf((x: Iterable[_]) => throw new Exception)
+res0: scala.reflect.Code[Iterable[_] => Nothing] = Code(manifest = scala.Function1[scala.collection.Iterable[Any], Nothing])
+
+scala>
+
+scala>
diff --git a/test/files/run/t4875.scala b/test/files/run/t4875.scala
new file mode 100644
index 0000000000..c17211aede
--- /dev/null
+++ b/test/files/run/t4875.scala
@@ -0,0 +1,12 @@
+import scala.tools.nsc.interpreter._
+import scala.tools.partest.ReplTest
+
+object Test extends ReplTest {
+ class M[@specialized T] { }
+
+ def code = """
+ |import scala.reflect.Code
+ |def codeOf[A](code: Code[A]) = code
+ |codeOf((x: Iterable[_]) => throw new Exception)
+ """.stripMargin
+}