blob: 638077e64ade2dbdeb224d3901c71c05e248b341 (
plain) (
tree)
|
|
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
}
|