summaryrefslogtreecommitdiff
path: root/test/files/neg
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-05-23 09:25:11 +0200
committerJason Zaugg <jzaugg@gmail.com>2013-05-31 13:40:27 +0200
commitd2faeb9ae60389668f1b5f45eb91c73127401e40 (patch)
tree5a2448d8a6a3bbc14ce81d90c68300a31c56b3b9 /test/files/neg
parent681f2070053bc6f3133425b44083fe056bfeb1fa (diff)
downloadscala-d2faeb9ae60389668f1b5f45eb91c73127401e40.tar.gz
scala-d2faeb9ae60389668f1b5f45eb91c73127401e40.tar.bz2
scala-d2faeb9ae60389668f1b5f45eb91c73127401e40.zip
SI-7507 Fix lookup of private[this] member in presence of self type.
In the following code: trait Cake extends Slice trait Slice { self: Cake => // must have self type that extends `Slice` private[this] val bippy = () // must be private[this] locally(bippy) } `ThisType(<Slice>)`.findMember(bippy)` excluded the private local member on the grounds that the first class in the base type sequence, `Cake`, was not contained in `Slice`. scala> val thisType = typeOf[Slice].typeSymbol.thisType thisType: $r.intp.global.Type = Slice.this.type scala> thisType.baseClasses res6: List[$r.intp.global.Symbol] = List(trait Cake, trait Slice, class Object, class Any) This commit changes `findMember` to use the symbol of the `ThisType`, rather than the first base class, as the location of the selection.
Diffstat (limited to 'test/files/neg')
-rw-r--r--test/files/neg/t7507.check4
-rw-r--r--test/files/neg/t7507.scala7
2 files changed, 11 insertions, 0 deletions
diff --git a/test/files/neg/t7507.check b/test/files/neg/t7507.check
new file mode 100644
index 0000000000..d402869fd4
--- /dev/null
+++ b/test/files/neg/t7507.check
@@ -0,0 +1,4 @@
+t7507.scala:6: error: value bippy in trait Cake cannot be accessed in Cake
+ locally(bippy)
+ ^
+one error found
diff --git a/test/files/neg/t7507.scala b/test/files/neg/t7507.scala
new file mode 100644
index 0000000000..1b4756d955
--- /dev/null
+++ b/test/files/neg/t7507.scala
@@ -0,0 +1,7 @@
+trait Cake extends Slice {
+ private[this] val bippy = ()
+}
+
+trait Slice { self: Cake =>
+ locally(bippy)
+}