summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2013-12-10 11:17:47 -0800
committerAdriaan Moors <adriaan.moors@typesafe.com>2013-12-10 11:17:47 -0800
commit4aaee3bd20289e617d9fc2d9f41cb6368c7e09d1 (patch)
tree5a9e576cb61606e0785a69dccb5e3a1c67470d28 /test
parent0b77398be2fbfc9270ae8af0ef56964a5eab5537 (diff)
parent006e2f2aadf5d15ff1b9b32f1b7e96960b778933 (diff)
downloadscala-4aaee3bd20289e617d9fc2d9f41cb6368c7e09d1.tar.gz
scala-4aaee3bd20289e617d9fc2d9f41cb6368c7e09d1.tar.bz2
scala-4aaee3bd20289e617d9fc2d9f41cb6368c7e09d1.zip
Merge pull request #3249 from retronym/ticket/7912
SI-7912 Be defensive calling `toString` in `MatchError#getMessage`
Diffstat (limited to 'test')
-rw-r--r--test/files/run/t7912.scala16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/files/run/t7912.scala b/test/files/run/t7912.scala
new file mode 100644
index 0000000000..3d603e0e97
--- /dev/null
+++ b/test/files/run/t7912.scala
@@ -0,0 +1,16 @@
+case object A { override def toString = ??? }
+
+object Test {
+ def foo: Int = (A: Any) match {
+ case 0 => 0
+ }
+ def main(args: Array[String]): Unit = {
+ try {
+ foo
+ sys.error("no exception")
+ } catch {
+ case me: MatchError => assert(me.getMessage == "an instance of class A$", me.getMessage)
+ case ex: Throwable => sys.error("not a match error: " + ex.getClass)
+ }
+ }
+}