summaryrefslogtreecommitdiff
path: root/test/pending/run/t5882.scala
diff options
context:
space:
mode:
authorGrzegorz Kossakowski <grzegorz.kossakowski@gmail.com>2012-10-03 14:43:30 +0200
committerGrzegorz Kossakowski <grzegorz.kossakowski@gmail.com>2012-10-03 14:43:30 +0200
commit5d9cde105e804d14e2c15c3e15c147a56cb67ff1 (patch)
tree7d1ea64620c7e782a302ee7108a21fc6e4388853 /test/pending/run/t5882.scala
parentea9e4ec55ebb5dd6aaf22862622add7608e3f7a0 (diff)
downloadscala-5d9cde105e804d14e2c15c3e15c147a56cb67ff1.tar.gz
scala-5d9cde105e804d14e2c15c3e15c147a56cb67ff1.tar.bz2
scala-5d9cde105e804d14e2c15c3e15c147a56cb67ff1.zip
Put more implementation restrictions on value classes.
Nested objects, classes and lazy vals are disallowed at any nesting level in value classes; e.g. lazy vals local to a method defined in a value class. There are still allowed in universal traits. This is a temporary, implementation restriction that is planned to be addressed in future releases of Scala. Error messages has been updated to communicate that intent. Moved tests for SI-5582 and SI-6408 to pending folder. They have to stay there until implementation restrictions are addressed. Closes SI-6408 and SI-6432. Review by @odersky, @harrah and @adriaanm.
Diffstat (limited to 'test/pending/run/t5882.scala')
-rw-r--r--test/pending/run/t5882.scala14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/pending/run/t5882.scala b/test/pending/run/t5882.scala
new file mode 100644
index 0000000000..47996d3068
--- /dev/null
+++ b/test/pending/run/t5882.scala
@@ -0,0 +1,14 @@
+// SIP-15 was revised to allow nested classes in value classes.
+// This test checks that their basic functionality.
+
+class NodeOps(val n: Any) extends AnyVal { self =>
+ class Foo() { def show = self.show(n) }
+ def show(x: Any) = x.toString
+}
+
+
+object Test extends App {
+
+ val n = new NodeOps("abc")
+ assert(new n.Foo().show == "abc")
+}