summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
Diffstat (limited to 'test/files')
-rw-r--r--test/files/run/t7763.flags1
-rw-r--r--test/files/run/t7763.scala20
2 files changed, 21 insertions, 0 deletions
diff --git a/test/files/run/t7763.flags b/test/files/run/t7763.flags
new file mode 100644
index 0000000000..7f4215d1bc
--- /dev/null
+++ b/test/files/run/t7763.flags
@@ -0,0 +1 @@
+-Ynooptimize \ No newline at end of file
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
+}