summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
authorGrzegorz Kossakowski <grzegorz.kossakowski@gmail.com>2013-10-03 02:55:34 -0700
committerGrzegorz Kossakowski <grzegorz.kossakowski@gmail.com>2013-10-03 02:55:34 -0700
commit33be64d195fd2c92707033af3538a92c4948d8c1 (patch)
treebb87acf76ccc1930a0886c2cb0c5760336f5c82d /test/files/run
parent44585a7ad43065e3d22df27cc0d17d1e9370b0f2 (diff)
parent4595ac665674b25af776d499ae1da61bb297d379 (diff)
downloadscala-33be64d195fd2c92707033af3538a92c4948d8c1.tar.gz
scala-33be64d195fd2c92707033af3538a92c4948d8c1.tar.bz2
scala-33be64d195fd2c92707033af3538a92c4948d8c1.zip
Merge pull request #2965 from retronym/ticket/7859
SI-7859 Value classes may wrap a non-public member
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/t7859/A_1.scala11
-rw-r--r--test/files/run/t7859/B_2.scala47
2 files changed, 58 insertions, 0 deletions
diff --git a/test/files/run/t7859/A_1.scala b/test/files/run/t7859/A_1.scala
new file mode 100644
index 0000000000..74f0709d4d
--- /dev/null
+++ b/test/files/run/t7859/A_1.scala
@@ -0,0 +1,11 @@
+class A(private val x: Int) extends AnyVal
+
+object A {
+ val Const = new A(0)
+}
+
+class A1(protected val x: Int) extends AnyVal
+
+package p {
+ class A2(private[p] val x: Int) extends AnyVal
+}
diff --git a/test/files/run/t7859/B_2.scala b/test/files/run/t7859/B_2.scala
new file mode 100644
index 0000000000..6b23af3abb
--- /dev/null
+++ b/test/files/run/t7859/B_2.scala
@@ -0,0 +1,47 @@
+class B private (private val b: Int) extends AnyVal
+object B {
+ val Const = new B(0)
+}
+
+// These tests will require erasure to unbox the value class.
+// We need to test under joint and separate compilation to check
+// that the 'notPRIVATE' flag on the param accessor is pickled.
+//
+// See also SI-6601.
+object Test {
+ def main(args: Array[String]) {
+ unboxA
+ unboxA1
+ unboxA2
+ unboxB
+ }
+
+ def unboxA {
+ val o: Some[A] = Some(A.Const)
+ val a = o.get
+ def id(a: A): A = a
+ id(a)
+ }
+
+ def unboxA1 {
+ val o: Some[A1] = Some(new A1(0))
+ val a = o.get
+ def id(a: A1): A1 = a
+ id(a)
+ }
+
+ def unboxA2 {
+ import p.A2
+ val o: Some[A2] = Some(new A2(0))
+ val a = o.get
+ def id(a: A2): A2 = a
+ id(a)
+ }
+
+ def unboxB {
+ val o: Some[B] = Some(B.Const)
+ val b = o.get
+ def id(b: B): B = b
+ id(b)
+ }
+}