aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/transform/PatternMatcher.scala
diff options
context:
space:
mode:
authorDmitry Petrashko <dmitry.petrashko@gmail.com>2014-09-26 14:59:51 +0200
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2014-10-11 06:38:11 +0200
commitcc792576ff1174820d68d5e10c39f909dd5b39ec (patch)
tree455a1f02b833d03027580e0ac863147922064cfa /src/dotty/tools/dotc/transform/PatternMatcher.scala
parentd936dec0c27d43dc861194594ecc22c4770450bd (diff)
downloaddotty-cc792576ff1174820d68d5e10c39f909dd5b39ec.tar.gz
dotty-cc792576ff1174820d68d5e10c39f909dd5b39ec.tar.bz2
dotty-cc792576ff1174820d68d5e10c39f909dd5b39ec.zip
Make SubstOnlyTreeMaker maintain type-safety.
Implementation of pattern sel match { x => <body> } used to replace references to x by references to sel in <body>. This is not type correct and it also requires additional traversal of body. Now SubstOnlyTreeMaker generates a `x = sel` statement.
Diffstat (limited to 'src/dotty/tools/dotc/transform/PatternMatcher.scala')
-rw-r--r--src/dotty/tools/dotc/transform/PatternMatcher.scala6
1 files changed, 3 insertions, 3 deletions
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 {