diff options
author | Martin Odersky <odersky@gmail.com> | 2015-05-17 13:27:38 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-05-21 17:41:14 +0200 |
commit | 74490a2315ce8c38fdf6905e713e57005bf085c7 (patch) | |
tree | ed70dec976c29990f8583fb7033dca6f32b144d2 /src/dotty/tools/dotc/transform/PatternMatcher.scala | |
parent | ff96f13f0fb7f69d6dd747908281373031b9c545 (diff) | |
download | dotty-74490a2315ce8c38fdf6905e713e57005bf085c7.tar.gz dotty-74490a2315ce8c38fdf6905e713e57005bf085c7.tar.bz2 dotty-74490a2315ce8c38fdf6905e713e57005bf085c7.zip |
Fix DenotationNotDefinedHere in pattern matcher
This was uncovered by previous commit "Fix isSubType bug ...".
Also removed two redundants ".fresh" calls in "fresh.addMode".
Diffstat (limited to 'src/dotty/tools/dotc/transform/PatternMatcher.scala')
-rw-r--r-- | src/dotty/tools/dotc/transform/PatternMatcher.scala | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/transform/PatternMatcher.scala b/src/dotty/tools/dotc/transform/PatternMatcher.scala index d665aa0c5..507dbb0ce 100644 --- a/src/dotty/tools/dotc/transform/PatternMatcher.scala +++ b/src/dotty/tools/dotc/transform/PatternMatcher.scala @@ -21,6 +21,7 @@ import ast.Trees._ import Applications._ import TypeApplications._ import SymUtils._, core.NameOps._ +import typer.Mode import dotty.tools.dotc.util.Positions.Position import dotty.tools.dotc.core.Decorators._ @@ -464,8 +465,9 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans // all potentially stored subpat binders val potentiallyStoredBinders = stored.unzip._1.toSet // compute intersection of all symbols in the tree `in` and all potentially stored subpat binders - new DeepFolder[Unit]((x: Unit, t:Tree) => + def computeBinders(implicit ctx: Context) = new DeepFolder[Unit]((x: Unit, t:Tree) => if (potentiallyStoredBinders(t.symbol)) usedBinders += t.symbol).apply((), in) + computeBinders(ctx.addMode(Mode.FutureDefsOK)) // trigged a NotDefinedHere on $outer when compiler dotc/printing if (usedBinders.isEmpty) in else { |