File tree Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -4391,6 +4391,8 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
43914391 foldTree(x, tpt)(owner)
43924392 case Typed (expr, tpt) =>
43934393 foldTree(foldTree(x, expr)(owner), tpt)(owner)
4394+ case TypedOrTest (expr, tpt) =>
4395+ foldTree(foldTree(x, expr)(owner), tpt)(owner)
43944396 case NamedArg (_, arg) =>
43954397 foldTree(x, arg)(owner)
43964398 case Assign (lhs, rhs) =>
Original file line number Diff line number Diff line change 1+ package i14393
2+ import scala .quoted .*
3+
4+ object M {
5+
6+ inline def useFoldTree [X ](inline x: X ): X = $ {
7+ useFoldTreeImpl(' x )
8+ }
9+
10+ def useFoldTreeImpl [X : Type ](x: Expr [X ])(using Quotes ): Expr [X ] = {
11+ import quotes .reflect .*
12+ val search = new TreeAccumulator [Int ] {
13+ def foldTree (s: Int , tree : Tree )(owner : Symbol ): Int =
14+ foldOverTree(s,tree)(owner)
15+ }
16+ search.foldTree(0 ,x.asTerm)(Symbol .spliceOwner)
17+ x
18+ }
19+
20+ }
Original file line number Diff line number Diff line change 1+ package i14393
2+
3+ def thing () =
4+ M .useFoldTree {
5+
6+ Option (" " ) match
7+ case None =>
8+ case Some (_) =>
9+ ???
10+
11+ }
You can’t perform that action at this time.
0 commit comments