diff options
author | Martin Odersky <odersky@gmail.com> | 2016-10-31 17:33:00 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-10-31 17:33:00 +0100 |
commit | 1dea9916e686adc96df9d7886346af2ed1abe45f (patch) | |
tree | e97b68171788ead972962bd17a59fd560296098d /src/dotty/tools/dotc/core/SymDenotations.scala | |
parent | 01ae7ddfd4956660ed4897f5d2773587f845204c (diff) | |
download | dotty-1dea9916e686adc96df9d7886346af2ed1abe45f.tar.gz dotty-1dea9916e686adc96df9d7886346af2ed1abe45f.tar.bz2 dotty-1dea9916e686adc96df9d7886346af2ed1abe45f.zip |
Fix #1637: Future defs are always OK
Drop special mode that handles future defs without which we
get DenotationNotDefinedHere errors. In more than a year, this
has only turned up false negatives. So I think it's better to
drop the check, and the contortions needed to deal with it.
Diffstat (limited to 'src/dotty/tools/dotc/core/SymDenotations.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/SymDenotations.scala | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala index a98d6732a..a25be0a1f 100644 --- a/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/src/dotty/tools/dotc/core/SymDenotations.scala @@ -645,21 +645,10 @@ object SymDenotations { final def isAccessibleFrom(pre: Type, superAccess: Boolean = false, whyNot: StringBuffer = null)(implicit ctx: Context): Boolean = { /** Are we inside definition of `boundary`? */ - def accessWithin(boundary: Symbol) = { - def test(implicit ctx: Context) = - ctx.owner.isContainedIn(boundary) && - (!(this is JavaDefined) || // disregard package nesting for Java - ctx.owner.enclosingPackageClass == boundary.enclosingPackageClass) - try test - catch { - // It might be we are in a definition whose symbol is not defined at the - // period where the test is made. Retry with FutureDefsOK. The reason - // for not doing this outright is speed. We would like to avoid - // creating a new context object each time we call accessWithin. - // Note that the exception should be thrown only infrequently. - case ex: NotDefinedHere => test(ctx.addMode(Mode.FutureDefsOK)) - } - } + def accessWithin(boundary: Symbol) = + ctx.owner.isContainedIn(boundary) && + (!(this is JavaDefined) || // disregard package nesting for Java + ctx.owner.enclosingPackageClass == boundary.enclosingPackageClass) /** Are we within definition of linked class of `boundary`? */ def accessWithinLinked(boundary: Symbol) = { @@ -1872,7 +1861,6 @@ object SymDenotations { } @sharable val NoDenotation = new NoDenotation - @sharable val NotDefinedHereDenotation = new NoDenotation // ---- Completion -------------------------------------------------------- |