File tree 1 file changed +8
-3
lines changed
library/src-3.x/scala/internal/quoted
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -40,9 +40,14 @@ object Matcher {
40
40
inline def withEnv [T ](env : Env )(body : => given Env => T ): T = body given env
41
41
42
42
/** Check that all trees match with =#= and concatenate the results with && */
43
- def (scrutinees : List [Tree ]) =##= (patterns : List [Tree ]) given Env : Matching =
44
- if (scrutinees.size != patterns.size) notMatched
45
- else foldMatchings(scrutinees.zip(patterns).map((s, p) => s =#= p): _* )
43
+ def (scrutinees : List [Tree ]) =##= (patterns : List [Tree ]) given Env : Matching = {
44
+ def rec (l1 : List [Tree ], l2 : List [Tree ]): Matching = (l1, l2) match {
45
+ case (x :: xs, y :: ys) => x =#= y && rec(xs, ys)
46
+ case (Nil , Nil ) => matched
47
+ case _ => notMatched
48
+ }
49
+ rec(scrutinees, patterns)
50
+ }
46
51
47
52
/** Check that the trees match and return the contents from the pattern holes.
48
53
* Return None if the trees do not match otherwise return Some of a tuple containing all the contents in the holes.
You can’t perform that action at this time.
0 commit comments