From cc792576ff1174820d68d5e10c39f909dd5b39ec Mon Sep 17 00:00:00 2001 From: Dmitry Petrashko Date: Fri, 26 Sep 2014 14:59:51 +0200 Subject: Make SubstOnlyTreeMaker maintain type-safety. Implementation of pattern sel match { x => } used to replace references to x by references to sel in . This is not type correct and it also requires additional traversal of body. Now SubstOnlyTreeMaker generates a `x = sel` statement. --- src/dotty/tools/dotc/transform/PatternMatcher.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/dotty/tools/dotc/transform/PatternMatcher.scala') diff --git a/src/dotty/tools/dotc/transform/PatternMatcher.scala b/src/dotty/tools/dotc/transform/PatternMatcher.scala index 9fbf705b9..e7780a128 100644 --- a/src/dotty/tools/dotc/transform/PatternMatcher.scala +++ b/src/dotty/tools/dotc/transform/PatternMatcher.scala @@ -427,9 +427,9 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans case class SubstOnlyTreeMaker(prevBinder: Symbol, nextBinder: Symbol) extends TreeMaker { val pos = Positions.NoPosition - val localSubstitution = Substitution(prevBinder, ref(nextBinder)) - def chainBefore(next: Tree)(casegen: Casegen): Tree = /*substitution(*/next//) - override def toString = "S" + localSubstitution + val localSubstitution = EmptySubstitution + def chainBefore(next: Tree)(casegen: Casegen): Tree = Block(List(ValDef(prevBinder.asTerm, ref(nextBinder))), next) + //override def toString = "S" + localSubstitution } sealed abstract class FunTreeMaker extends TreeMaker { -- cgit v1.2.3