From 1b2ac4e618fd3e95efdeb965b0deebc2c5f78580 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Sun, 7 Oct 2012 15:16:31 +0200 Subject: SI-6483 Prohibit super[T] references in value classes. This seems the safest course of action for 2.10.0. --- test/files/neg/t6483.check | 9 +++++++++ test/files/neg/t6483.scala | 24 ++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 test/files/neg/t6483.check create mode 100644 test/files/neg/t6483.scala (limited to 'test') diff --git a/test/files/neg/t6483.check b/test/files/neg/t6483.check new file mode 100644 index 0000000000..66e3507107 --- /dev/null +++ b/test/files/neg/t6483.check @@ -0,0 +1,9 @@ +t6483.scala:7: error: implementation restriction: qualified super reference is not allowed in value class +This restriction is planned to be removed in subsequent releases. + override def foo = super[T].foo // error + ^ +t6483.scala:20: error: implementation restriction: nested class is not allowed in value class +This restriction is planned to be removed in subsequent releases. + class Inner extends T { + ^ +two errors found diff --git a/test/files/neg/t6483.scala b/test/files/neg/t6483.scala new file mode 100644 index 0000000000..bd99f68fa4 --- /dev/null +++ b/test/files/neg/t6483.scala @@ -0,0 +1,24 @@ +trait T extends Any { + def foo = 1 + type X +} + +class C1(val a: Any) extends AnyVal with T { + override def foo = super[T].foo // error +} + +class C2(val a: Int) extends AnyVal with T { + override def foo = super.foo + a // okay +} + +class C3(val a: Int) extends AnyVal with T { + override def foo = C3.super.foo + a // okay +} + +class C4(val a: Int) extends AnyVal with T { + def foo { + class Inner extends T { + override def foo = super[T].foo + a // no (direct) error, other than that a nested class is currently illegal. + } + } +} -- cgit v1.2.3