Skip to content

Commit 47c5070

Browse files
committed
wip
1 parent 92e0f01 commit 47c5070

File tree

5 files changed

+135
-788
lines changed

5 files changed

+135
-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: 22 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.
@@ -45,6 +45,17 @@ object Matcher {
4545
*/
4646
def treeMatches(scrutinee: Tree, pattern: Tree)(implicit env: Set[(Symbol, Symbol)]): Option[Tuple] = {
4747

48+
println("++++++++++++++++++++++++++++++++++++++++=")
49+
println("++++++++++++++++++++++++++++++++++++++++=")
50+
println(scrutinee.show)
51+
println(scrutinee.showExtractors)
52+
println()
53+
println(pattern.show)
54+
println(pattern.showExtractors)
55+
println()
56+
println()
57+
println()
58+
4859
/** Check that both are `val` or both are `lazy val` or both are `var` **/
4960
def checkValFlags(): Boolean = {
5061
import Flags._
@@ -117,7 +128,14 @@ object Matcher {
117128
foldMatchings(treeMatches(fn1, fn2), treesMatch(args1, args2))
118129

119130
case (Block(stats1, expr1), Block(stats2, expr2)) =>
120-
foldMatchings(treesMatch(stats1, stats2), treeMatches(expr1, expr2))
131+
def rec(scrutinees: List[Tree], patterns: List[Tree], acc: Option[Tuple]): Option[Tuple] = (scrutinees, patterns) match {
132+
case (x :: xs, y :: ys) =>
133+
rec(xs, ys, foldMatchings(acc, treeMatches(x, y)))
134+
case (Nil, Nil) =>
135+
foldMatchings(acc, treeMatches(expr1, expr2))
136+
case _ => None
137+
}
138+
rec(stats1, stats2, Some(()))
121139

122140
case (If(cond1, thenp1, elsep1), If(cond2, thenp2, elsep2)) =>
123141
foldMatchings(treeMatches(cond1, cond2), treeMatches(thenp1, thenp2), treeMatches(elsep1, elsep2))
@@ -219,7 +237,8 @@ object Matcher {
219237
|
220238
|${pattern.showExtractors}
221239
|
222-
|
240+
|with environment
241+
|${env}
223242
|
224243
|
225244
|""".stripMargin)

0 commit comments

Comments
 (0)