diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-08-29 08:33:32 -0700 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-08-29 08:33:32 -0700 |
commit | 44b178b37698fd51afa8eed95e98b9ff7d38b8ab (patch) | |
tree | a126fa0d8ab05519a4f3fd645689d62e50e73179 /test/files/run | |
parent | 8679c217766326797bc13faf480f05064eb3df15 (diff) | |
parent | 6ad8eb4d899e08288f7c9243910f9c154b9fa21d (diff) | |
download | scala-44b178b37698fd51afa8eed95e98b9ff7d38b8ab.tar.gz scala-44b178b37698fd51afa8eed95e98b9ff7d38b8ab.tar.bz2 scala-44b178b37698fd51afa8eed95e98b9ff7d38b8ab.zip |
Merge pull request #2849 from retronym/ticket/7763
SI-7763 Avoid dropping casts in erasure
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/t7763.scala | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/files/run/t7763.scala b/test/files/run/t7763.scala new file mode 100644 index 0000000000..638077e64a --- /dev/null +++ b/test/files/run/t7763.scala @@ -0,0 +1,20 @@ +object Test { + class A; class B + def main(args: Array[String]) { + def noExpectedType() { + a().asInstanceOf[B] // cast elided! + } + def withExpectedType(): B = { + a().asInstanceOf[B] + } + def test(a: => Any) = try { + a + sys.error("no CCE!") + } catch {case _: ClassCastException => } + + test(noExpectedType()) + test(withExpectedType()) + } + + def a(): Object = new A +} |