diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-12-10 11:17:47 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-12-10 11:17:47 -0800 |
commit | 4aaee3bd20289e617d9fc2d9f41cb6368c7e09d1 (patch) | |
tree | 5a9e576cb61606e0785a69dccb5e3a1c67470d28 /test/files | |
parent | 0b77398be2fbfc9270ae8af0ef56964a5eab5537 (diff) | |
parent | 006e2f2aadf5d15ff1b9b32f1b7e96960b778933 (diff) | |
download | scala-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/files')
-rw-r--r-- | test/files/run/t7912.scala | 16 |
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) + } + } +} |