summaryrefslogtreecommitdiff
path: root/test/files/neg
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-03-12 19:19:20 -0700
committerPaul Phillips <paulp@improving.org>2013-03-12 19:19:20 -0700
commitc964643604ea9e431f4076069fbbc18953d3c1c9 (patch)
treee74367853bad0b03814d4e62c3dace4b2716664d /test/files/neg
parent2f38bb8e5c69af0db63e05da78301dda916fad6f (diff)
parent34faa0d073a8613deebffe7605fd8a5e9a93afbc (diff)
downloadscala-c964643604ea9e431f4076069fbbc18953d3c1c9.tar.gz
scala-c964643604ea9e431f4076069fbbc18953d3c1c9.tar.bz2
scala-c964643604ea9e431f4076069fbbc18953d3c1c9.zip
Merge pull request #2236 from retronym/ticket/6601-2
SI-6601 Close access loophole for value class constructors
Diffstat (limited to 'test/files/neg')
-rw-r--r--test/files/neg/t6601.check4
-rw-r--r--test/files/neg/t6601/AccessPrivateConstructor_2.scala3
-rw-r--r--test/files/neg/t6601/PrivateConstructor_1.scala1
3 files changed, 8 insertions, 0 deletions
diff --git a/test/files/neg/t6601.check b/test/files/neg/t6601.check
new file mode 100644
index 0000000000..1410e1b11a
--- /dev/null
+++ b/test/files/neg/t6601.check
@@ -0,0 +1,4 @@
+AccessPrivateConstructor_2.scala:2: error: constructor PrivateConstructor in class PrivateConstructor cannot be accessed in class AccessPrivateConstructor
+ new PrivateConstructor("") // Scalac should forbid accessing to the private constructor!
+ ^
+one error found
diff --git a/test/files/neg/t6601/AccessPrivateConstructor_2.scala b/test/files/neg/t6601/AccessPrivateConstructor_2.scala
new file mode 100644
index 0000000000..816bc10d79
--- /dev/null
+++ b/test/files/neg/t6601/AccessPrivateConstructor_2.scala
@@ -0,0 +1,3 @@
+class AccessPrivateConstructor {
+ new PrivateConstructor("") // Scalac should forbid accessing to the private constructor!
+}
diff --git a/test/files/neg/t6601/PrivateConstructor_1.scala b/test/files/neg/t6601/PrivateConstructor_1.scala
new file mode 100644
index 0000000000..f09d7ad068
--- /dev/null
+++ b/test/files/neg/t6601/PrivateConstructor_1.scala
@@ -0,0 +1 @@
+class PrivateConstructor private(val s: String) extends AnyVal