@@ -128,7 +128,7 @@ object Matcher {
128
128
129
129
// TODO improve performance
130
130
131
- // TODO use flag from qctx.tasty.rootContext. Maybe -debug or add -debug-macros
131
+ // TODO use flag from qctx.tasty. Maybe -debug or add -debug-macros
132
132
private final val debug = false
133
133
134
134
import qctx .tasty ._
@@ -203,7 +203,7 @@ object Matcher {
203
203
204
204
extension (scrutinees : List [Tree ]):
205
205
/** Check that all trees match with =?= and concatenate the results with &&& */
206
- private def =?= (patterns : List [Tree ])(using Context , Env ): Matching =
206
+ private def =?= (patterns : List [Tree ])(using Env ): Matching =
207
207
matchLists(scrutinees, patterns)(_ =?= _)
208
208
209
209
extension (scrutinee0 : Tree ):
@@ -215,7 +215,7 @@ object Matcher {
215
215
* @param `summon[Env]` Set of tuples containing pairs of symbols (s, p) where s defines a symbol in `scrutinee` which corresponds to symbol p in `pattern`.
216
216
* @return `None` if it did not match or `Some(tup: Tuple)` if it matched where `tup` contains the contents of the holes.
217
217
*/
218
- private def =?= (pattern0 : Tree )(using Context , Env ): Matching = {
218
+ private def =?= (pattern0 : Tree )(using Env ): Matching = {
219
219
220
220
/* Match block flattening */ // TODO move to cases
221
221
/** Normalize the tree */
@@ -374,7 +374,7 @@ object Matcher {
374
374
/* Match val */
375
375
case (ValDef (_, tpt1, rhs1), ValDef (_, tpt2, rhs2)) if checkValFlags() =>
376
376
def rhsEnv = summon[Env ] + (scrutinee.symbol -> pattern.symbol)
377
- tpt1 =?= tpt2 &&& treeOptMatches(rhs1, rhs2)(using summon[ Context ], rhsEnv)
377
+ tpt1 =?= tpt2 &&& treeOptMatches(rhs1, rhs2)(using rhsEnv)
378
378
379
379
/* Match def */
380
380
case (DefDef (_, typeParams1, paramss1, tpt1, Some (rhs1)), DefDef (_, typeParams2, paramss2, tpt2, Some (rhs2))) =>
@@ -423,11 +423,11 @@ object Matcher {
423
423
424
424
private object ClosedPatternTerm {
425
425
/** Matches a term that does not contain free variables defined in the pattern (i.e. not defined in `Env`) */
426
- def unapply (term : Term )(using Context , Env ): Option [term.type ] =
426
+ def unapply (term : Term )(using Env ): Option [term.type ] =
427
427
if freePatternVars(term).isEmpty then Some (term) else None
428
428
429
429
/** Return all free variables of the term defined in the pattern (i.e. defined in `Env`) */
430
- def freePatternVars (term : Term )(using ctx : Context , env : Env ): Set [Symbol ] =
430
+ def freePatternVars (term : Term )(using env : Env ): Set [Symbol ] =
431
431
val accumulator = new TreeAccumulator [Set [Symbol ]] {
432
432
def foldTree (x : Set [Symbol ], tree : Tree )(using ctx : Context ): Set [Symbol ] =
433
433
tree match
@@ -438,7 +438,7 @@ object Matcher {
438
438
}
439
439
440
440
private object IdentArgs {
441
- def unapply (args : List [Term ])( using Context ) : Option [List [Ident ]] =
441
+ def unapply (args : List [Term ]): Option [List [Ident ]] =
442
442
args.foldRight(Option (List .empty[Ident ])) {
443
443
case (id : Ident , Some (acc)) => Some (id :: acc)
444
444
case (Block (List (DefDef (" $anonfun" , Nil , List (params), Inferred (), Some (Apply (id : Ident , args)))), Closure (Ident (" $anonfun" ), None )), Some (acc))
@@ -448,7 +448,7 @@ object Matcher {
448
448
}
449
449
}
450
450
451
- private def treeOptMatches (scrutinee : Option [Tree ], pattern : Option [Tree ])(using Context , Env ): Matching = {
451
+ private def treeOptMatches (scrutinee : Option [Tree ], pattern : Option [Tree ])(using Env ): Matching = {
452
452
(scrutinee, pattern) match {
453
453
case (Some (x), Some (y)) => x =?= y
454
454
case (None , None ) => matched
0 commit comments