diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-02-11 19:39:39 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-02-11 19:39:39 -0800 |
commit | 98320a6d5947f26e7252b025cf56a0763b39cd07 (patch) | |
tree | 34bb175cd1839ba8187e12562fa31ea5622d8a94 /test/files/neg | |
parent | e3d624dd2760f2593949a1b5493f5a92fb02138a (diff) | |
parent | 47885ff665a951d2574a7ca5b2ea27c30b67c862 (diff) | |
download | scala-98320a6d5947f26e7252b025cf56a0763b39cd07.tar.gz scala-98320a6d5947f26e7252b025cf56a0763b39cd07.tar.bz2 scala-98320a6d5947f26e7252b025cf56a0763b39cd07.zip |
Merge pull request #3503 from adriaanm/rebase-3440
SI-7475 Private members aren't inheritable, findMember overhaul
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/forgot-interpolator.check | 5 | ||||
-rw-r--r-- | test/files/neg/forgot-interpolator.scala | 2 | ||||
-rw-r--r-- | test/files/neg/t7475c.check | 7 | ||||
-rw-r--r-- | test/files/neg/t7475c.scala | 9 | ||||
-rw-r--r-- | test/files/neg/t7475d.check | 7 | ||||
-rw-r--r-- | test/files/neg/t7475e.check | 4 | ||||
-rw-r--r-- | test/files/neg/t7475e.scala | 12 | ||||
-rw-r--r-- | test/files/neg/t7475f.check | 10 | ||||
-rw-r--r-- | test/files/neg/t7475f.scala | 28 | ||||
-rw-r--r-- | test/files/neg/t7507.check | 2 |
10 files changed, 80 insertions, 6 deletions
diff --git a/test/files/neg/forgot-interpolator.check b/test/files/neg/forgot-interpolator.check index 157cbb4802..8988458982 100644 --- a/test/files/neg/forgot-interpolator.check +++ b/test/files/neg/forgot-interpolator.check @@ -10,9 +10,6 @@ forgot-interpolator.scala:30: warning: `$beppo` looks like an interpolated ident forgot-interpolator.scala:34: warning: `$aleppo` looks like an interpolated identifier! Did you forget the interpolator? def f = "$aleppo is a pepper and a city." // warn 4 ^ -forgot-interpolator.scala:42: warning: `$bar` looks like an interpolated identifier! Did you forget the interpolator? - def f = "$bar is private, shall we warn just in case?" // warn 5 - ^ forgot-interpolator.scala:47: warning: `$hippo` looks like an interpolated identifier! Did you forget the interpolator? def h = "$hippo takes an implicit" // warn 6 ^ @@ -26,5 +23,5 @@ forgot-interpolator.scala:90: warning: `$calico` looks like an interpolated iden def f4 = "I also salute $calico" // warn 9 ^ error: No warnings can be incurred under -Xfatal-warnings. -9 warnings found +8 warnings found one error found diff --git a/test/files/neg/forgot-interpolator.scala b/test/files/neg/forgot-interpolator.scala index 34a7c7aef4..a53054d890 100644 --- a/test/files/neg/forgot-interpolator.scala +++ b/test/files/neg/forgot-interpolator.scala @@ -39,7 +39,7 @@ package test { if (bar > 8) ??? // use it to avoid extra warning } class Baz extends Bar { - def f = "$bar is private, shall we warn just in case?" // warn 5 + def f = "$bar is private, shall we warn just in case?" // no longer a warning, private members aren't inherited! } class G { def g = "$greppo takes an arg" // no warn diff --git a/test/files/neg/t7475c.check b/test/files/neg/t7475c.check new file mode 100644 index 0000000000..472808131a --- /dev/null +++ b/test/files/neg/t7475c.check @@ -0,0 +1,7 @@ +t7475c.scala:6: error: value a is not a member of A.this.B + println(this.a) // wait, what? + ^ +t7475c.scala:7: error: value b is not a member of A.this.B + println(this.b) // wait, what? + ^ +two errors found diff --git a/test/files/neg/t7475c.scala b/test/files/neg/t7475c.scala new file mode 100644 index 0000000000..cd4a8762ca --- /dev/null +++ b/test/files/neg/t7475c.scala @@ -0,0 +1,9 @@ +class A { + private val a: Int = 0 + private[this] val b: Int = 0 + class B extends A { + def foo(a: A) = a.a // okay + println(this.a) // wait, what? + println(this.b) // wait, what? + } +} diff --git a/test/files/neg/t7475d.check b/test/files/neg/t7475d.check new file mode 100644 index 0000000000..6bd1da0d44 --- /dev/null +++ b/test/files/neg/t7475d.check @@ -0,0 +1,7 @@ +t7475d.scala:4: error: value priv is not a member of T.this.TT + (??? : TT).priv + ^ +t7475d.scala:10: error: value priv is not a member of U.this.UU + (??? : UU).priv + ^ +two errors found diff --git a/test/files/neg/t7475e.check b/test/files/neg/t7475e.check new file mode 100644 index 0000000000..48af2be51a --- /dev/null +++ b/test/files/neg/t7475e.check @@ -0,0 +1,4 @@ +t7475e.scala:8: error: value priv is not a member of Base.this.TT + (??? : TT).priv + ^ +one error found diff --git a/test/files/neg/t7475e.scala b/test/files/neg/t7475e.scala new file mode 100644 index 0000000000..e5c4877d6e --- /dev/null +++ b/test/files/neg/t7475e.scala @@ -0,0 +1,12 @@ +trait U { +} + +trait Base { + private val priv = 0 + + type TT = U with T // should exclude `priv` + (??? : TT).priv +} + +trait T extends Base { +} diff --git a/test/files/neg/t7475f.check b/test/files/neg/t7475f.check new file mode 100644 index 0000000000..a07a4480e2 --- /dev/null +++ b/test/files/neg/t7475f.check @@ -0,0 +1,10 @@ +t7475f.scala:12: error: method c1 in class C cannot be accessed in C[T] + c1 // a member, but inaccessible. + ^ +t7475f.scala:13: error: not found: value c2 + c2 // a member, but inaccessible. + ^ +t7475f.scala:26: error: value d2 is not a member of D[Any] + other.d2 // not a member + ^ +three errors found diff --git a/test/files/neg/t7475f.scala b/test/files/neg/t7475f.scala new file mode 100644 index 0000000000..6c5feadf19 --- /dev/null +++ b/test/files/neg/t7475f.scala @@ -0,0 +1,28 @@ +class C[T] extends D[T] { + private def c1 = 0 + private[this] def c2 = 0 +} + +trait D[T] { + self: C[T] => + + private def d1 = 0 + private[this] def d2 = 0 + + c1 // a member, but inaccessible. + c2 // a member, but inaccessible. + + d1 // okay + d2 // okay + + + class C { + d1 + d2 + } + + def x(other: D[Any]) { + other.d1 + other.d2 // not a member + } +} diff --git a/test/files/neg/t7507.check b/test/files/neg/t7507.check index d402869fd4..de30fc7057 100644 --- a/test/files/neg/t7507.check +++ b/test/files/neg/t7507.check @@ -1,4 +1,4 @@ -t7507.scala:6: error: value bippy in trait Cake cannot be accessed in Cake +t7507.scala:6: error: not found: value bippy locally(bippy) ^ one error found |