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/ast/tpd.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/ast/tpd.scala')
-rw-r--r-- | src/dotty/tools/dotc/ast/tpd.scala | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/dotty/tools/dotc/ast/tpd.scala b/src/dotty/tools/dotc/ast/tpd.scala index d8db3306c..77fa88213 100644 --- a/src/dotty/tools/dotc/ast/tpd.scala +++ b/src/dotty/tools/dotc/ast/tpd.scala @@ -295,7 +295,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { // ------ Making references ------------------------------------------------------ def prefixIsElidable(tp: NamedType)(implicit ctx: Context) = { - def test(implicit ctx: Context) = tp.prefix match { + val typeIsElidable = tp.prefix match { case NoPrefix => true case pre: ThisType => @@ -309,10 +309,9 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { case _ => false } - try test || tp.symbol.is(JavaStatic) || tp.symbol.hasAnnotation(defn.ScalaStaticAnnot) - catch { // See remark in SymDenotations#accessWithin - case ex: NotDefinedHere => test(ctx.addMode(Mode.FutureDefsOK)) - } + typeIsElidable || + tp.symbol.is(JavaStatic) || + tp.symbol.hasAnnotation(defn.ScalaStaticAnnot) } def needsSelect(tp: Type)(implicit ctx: Context) = tp match { @@ -605,7 +604,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { loop(from.owner, from :: froms, to :: tos) else { //println(i"change owner ${from :: froms}%, % ==> $tos of $tree") - new TreeTypeMap(oldOwners = from :: froms, newOwners = tos)(ctx.addMode(Mode.FutureDefsOK)).apply(tree) + new TreeTypeMap(oldOwners = from :: froms, newOwners = tos).apply(tree) } } loop(from, Nil, to :: Nil) @@ -631,7 +630,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { traverseChildren(tree) } } - traverser.traverse(tree)(ctx.addMode(Mode.FutureDefsOK)) + traverser.traverse(tree) tree } |