aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-02-08 14:35:53 +0100
committerMartin Odersky <odersky@gmail.com>2016-02-19 16:57:35 +0100
commitfc043bfb2e1c8fd0a73b87a4c955e3e09f6bf8c0 (patch)
tree1f2813884bfcd8fff4e558f6a61aa40b750b613e /tests
parenteb1908a9f2c61895cabe70c0ac0ebbe8ef14fcea (diff)
downloaddotty-fc043bfb2e1c8fd0a73b87a4c955e3e09f6bf8c0.tar.gz
dotty-fc043bfb2e1c8fd0a73b87a4c955e3e09f6bf8c0.tar.bz2
dotty-fc043bfb2e1c8fd0a73b87a4c955e3e09f6bf8c0.zip
Add checking for leaking private definitions
First version. Fixes #997.
Diffstat (limited to 'tests')
-rw-r--r--tests/neg/i997.scala45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/neg/i997.scala b/tests/neg/i997.scala
new file mode 100644
index 000000000..bfcf5637e
--- /dev/null
+++ b/tests/neg/i997.scala
@@ -0,0 +1,45 @@
+class C {
+
+ private type T = E
+ private val p: C = new C
+
+ def f1(x: T): Unit = () // error
+ def f2(x: p.D): Unit = () // error
+
+ val v1: T = ??? // error
+ val v2: p.D = ??? // error
+
+ type U1[X <: T] // error
+ type U2 = T // error
+
+ private class E {
+ def f1ok(x: T): Unit = () // ok
+ def f2ok(x: p.D): Unit = () // ok
+
+ val v1ok: T = ??? // ok
+ val v2ok: p.D = ??? // ok
+
+ type U1ok[X <: T] //ok
+ type U2ok = T //ok
+ }
+
+ class D extends E { // error
+ def f1(x: T): Unit = () // error
+ def f2(x: p.D): Unit = () // error
+
+ val v1: T = ??? // error
+ val v2: p.D = ??? // error
+
+ type U1[X <: T] // error
+ type U2 = T // error
+ }
+
+ class F(x: T) // error
+
+ class G private (x: T) // ok
+
+ private trait U
+
+ class H extends U // error
+
+}