diff options
Diffstat (limited to 'tests/neg')
-rw-r--r-- | tests/neg/i997.scala | 47 | ||||
-rw-r--r-- | tests/neg/i997a.scala | 19 |
2 files changed, 66 insertions, 0 deletions
diff --git a/tests/neg/i997.scala b/tests/neg/i997.scala new file mode 100644 index 000000000..8a21661fb --- /dev/null +++ b/tests/neg/i997.scala @@ -0,0 +1,47 @@ +class C { + + private type T = E + private type Tok = D + private val p: C = new C + + def f1(x: T): Unit = () // error + def f1(x: Tok): Unit = () // ok + 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 + +} diff --git a/tests/neg/i997a.scala b/tests/neg/i997a.scala new file mode 100644 index 000000000..eae56400f --- /dev/null +++ b/tests/neg/i997a.scala @@ -0,0 +1,19 @@ +class C { + + class Super + + object O { + + private case class CC(x: Int) + + private implicit class D(x: Int) extends Super + } + + import O._ + + println(O.CC(1)) // error: CC cannot be accessed + + val s: Super = 1 // error: type mismatch + + +} |