From 26c3f65241f49d96e2b3e853f71aa780ca8861c1 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 8 Apr 2011 16:31:26 +0000 Subject: Closes #4431. Review by extempore. --- test/files/neg/t4431.check | 7 +++++++ test/files/neg/t4431.scala | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 test/files/neg/t4431.check create mode 100644 test/files/neg/t4431.scala (limited to 'test/files') diff --git a/test/files/neg/t4431.check b/test/files/neg/t4431.check new file mode 100644 index 0000000000..7896ec1a62 --- /dev/null +++ b/test/files/neg/t4431.check @@ -0,0 +1,7 @@ +t4431.scala:5: error: class BB needs to be abstract, since there is a deferred declaration of method f which is not implemented in a subclass + class BB extends B { def f (): Unit } + ^ +t4431.scala:8: error: trait cannot redefine final method from class AnyRef + trait C { def wait (): Unit } + ^ +two errors found diff --git a/test/files/neg/t4431.scala b/test/files/neg/t4431.scala new file mode 100644 index 0000000000..5fbb239e04 --- /dev/null +++ b/test/files/neg/t4431.scala @@ -0,0 +1,16 @@ +object Test { + // this works. + class B { final def f(): Unit = () } + trait A extends B { def f (): Unit } + class BB extends B { def f (): Unit } + + // this earns a VerifyError. + trait C { def wait (): Unit } + class D { } + + def main(args: Array[String]): Unit = { + new B with A { } + new BB +// new D with C { } + } +} -- cgit v1.2.3