diff options
author | Josh Suereth <Joshua.Suereth@gmail.com> | 2012-10-09 13:56:43 -0700 |
---|---|---|
committer | Josh Suereth <Joshua.Suereth@gmail.com> | 2012-10-09 13:56:43 -0700 |
commit | e5127d94ef02cf71fdb9b95b24f8135c49d135ae (patch) | |
tree | 7b04b37483e090b70591850482a59ca36640b912 /test/files | |
parent | e55fa90fef1723ae42e7fc6d0040607db9a37526 (diff) | |
parent | 1b2ac4e618fd3e95efdeb965b0deebc2c5f78580 (diff) | |
download | scala-e5127d94ef02cf71fdb9b95b24f8135c49d135ae.tar.gz scala-e5127d94ef02cf71fdb9b95b24f8135c49d135ae.tar.bz2 scala-e5127d94ef02cf71fdb9b95b24f8135c49d135ae.zip |
Merge pull request #1471 from retronym/ticket/6483
SI-6483 Prohibit super[T] references in value classes.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/neg/t6483.check | 9 | ||||
-rw-r--r-- | test/files/neg/t6483.scala | 24 |
2 files changed, 33 insertions, 0 deletions
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. + } + } +} |