aboutsummaryrefslogtreecommitdiff
path: root/tests/untried/pos/t6601
diff options
context:
space:
mode:
Diffstat (limited to 'tests/untried/pos/t6601')
-rw-r--r--tests/untried/pos/t6601/PrivateValueClass_1.scala1
-rw-r--r--tests/untried/pos/t6601/UsePrivateValueClass_2.scala10
2 files changed, 11 insertions, 0 deletions
diff --git a/tests/untried/pos/t6601/PrivateValueClass_1.scala b/tests/untried/pos/t6601/PrivateValueClass_1.scala
new file mode 100644
index 000000000..dc0137420
--- /dev/null
+++ b/tests/untried/pos/t6601/PrivateValueClass_1.scala
@@ -0,0 +1 @@
+class V private (val a: Any) extends AnyVal
diff --git a/tests/untried/pos/t6601/UsePrivateValueClass_2.scala b/tests/untried/pos/t6601/UsePrivateValueClass_2.scala
new file mode 100644
index 000000000..461b8397b
--- /dev/null
+++ b/tests/untried/pos/t6601/UsePrivateValueClass_2.scala
@@ -0,0 +1,10 @@
+object Test {
+ // After the first attempt to make seprately compiled value
+ // classes respect the privacy of constructors, we got:
+ //
+ // exception when typing v.a().==(v.a())/class scala.reflect.internal.Trees$Apply
+ // constructor V in class V cannot be accessed in object Test in file test/files/pos/t6601/UsePrivateValueClass_2.scala
+ // scala.reflect.internal.Types$TypeError: constructor V in class V cannot be accessed in object Test
+ def foo(v: V) = v.a == v.a
+ def bar(v: V) = v == v
+}