Skip to content

Commit cb576ba

Browse files
committed
wip
1 parent 92e0f01 commit cb576ba

File tree

5 files changed

+127
-788
lines changed

5 files changed

+127
-788
lines changed

compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -472,16 +472,6 @@ class TreePickler(pickler: TastyPickler) {
472472
case Bind(name, body) =>
473473
registerDef(tree.symbol)
474474
writeByte(BIND)
475-
println()
476-
println(tree)
477-
println(tree.isTerm)
478-
println(name)
479-
println(body)
480-
println(tree.uniqueId)
481-
println(tree.symbol)
482-
println(tree.symbol.info)
483-
println()
484-
println()
485475
withLength {
486476
pickleName(name); pickleType(tree.symbol.info); pickleTree(body)
487477
}

library/src-3.x/scala/internal/quoted/Matcher.scala

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import scala.tasty._
88

99
object Matcher {
1010

11-
private final val debug = false
11+
private final val debug = true
1212

1313
/** Pattern matches an the scrutineeExpr aquainsnt the patternExpr and returns a tuple
1414
* with the matched holes if successful.
@@ -117,7 +117,17 @@ object Matcher {
117117
foldMatchings(treeMatches(fn1, fn2), treesMatch(args1, args2))
118118

119119
case (Block(stats1, expr1), Block(stats2, expr2)) =>
120-
foldMatchings(treesMatch(stats1, stats2), treeMatches(expr1, expr2))
120+
def rec(scrutinees: List[Tree], patterns: List[Tree], acc: Option[Tuple]): Option[Tuple] = (scrutinees, patterns) match {
121+
case (x :: xs, y :: ys) =>
122+
if (y.symbol.annots.exists(_.symbol.owner.name == "patternBindHole")) {
123+
println(y.show)
124+
rec(x :: xs, ys, acc)
125+
} else rec(xs, ys, foldMatchings(acc, treeMatches(x, y)))
126+
case (Nil, Nil) =>
127+
foldMatchings(acc, treeMatches(expr1, expr2))
128+
case _ => None
129+
}
130+
rec(stats1, stats2, Some(()))
121131

122132
case (If(cond1, thenp1, elsep1), If(cond2, thenp2, elsep2)) =>
123133
foldMatchings(treeMatches(cond1, cond2), treeMatches(thenp1, thenp2), treeMatches(elsep1, elsep2))
@@ -219,7 +229,8 @@ object Matcher {
219229
|
220230
|${pattern.showExtractors}
221231
|
222-
|
232+
|with environment
233+
|${env}
223234
|
224235
|
225236
|""".stripMargin)

0 commit comments

Comments
 (0)