aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/transform/ExpandPrivate.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-03-13 15:08:09 +0100
committerMartin Odersky <odersky@gmail.com>2016-03-13 15:08:09 +0100
commit9daf976a2040eaef2699cdaef6360fcbf8af6aa0 (patch)
treedc1028f0ab288da2f76b27fab485ac655e8de857 /src/dotty/tools/dotc/transform/ExpandPrivate.scala
parentd500b1d6caaafcc9258263c98dc5250f662410c7 (diff)
downloaddotty-9daf976a2040eaef2699cdaef6360fcbf8af6aa0.tar.gz
dotty-9daf976a2040eaef2699cdaef6360fcbf8af6aa0.tar.bz2
dotty-9daf976a2040eaef2699cdaef6360fcbf8af6aa0.zip
Assert that ensureNotPrivate does not break on separate compilation
When ensureNotPrivate changes the status of a formerly private declaration, assert that the reference to the declaration is in the same compilation unit, as otherwise the nehavior would be different under separate compilation.
Diffstat (limited to 'src/dotty/tools/dotc/transform/ExpandPrivate.scala')
-rw-r--r--src/dotty/tools/dotc/transform/ExpandPrivate.scala5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/transform/ExpandPrivate.scala b/src/dotty/tools/dotc/transform/ExpandPrivate.scala
index f44be3958..a6f203478 100644
--- a/src/dotty/tools/dotc/transform/ExpandPrivate.scala
+++ b/src/dotty/tools/dotc/transform/ExpandPrivate.scala
@@ -57,8 +57,11 @@ class ExpandPrivate extends MiniPhaseTransform with IdentityDenotTransformer { t
* static members of the companion class, we should tighten the condition below.
*/
private def ensurePrivateAccessible(d: SymDenotation)(implicit ctx: Context) =
- if (d.is(PrivateTerm) && d.owner != ctx.owner.enclosingClass)
+ if (d.is(PrivateTerm) && d.owner != ctx.owner.enclosingClass) {
+ assert(d.symbol.sourceFile == ctx.source.file,
+ i"private ${d.symbol.showLocated} in ${d.symbol.sourceFile} accessed from ${ctx.owner.showLocated} in ${ctx.source.file}")
d.ensureNotPrivate.installAfter(thisTransform)
+ }
override def transformIdent(tree: Ident)(implicit ctx: Context, info: TransformerInfo) = {
ensurePrivateAccessible(tree.symbol)