@@ -6,7 +6,6 @@ import scala.annotation.{Annotation, compileTimeOnly}
6
6
7
7
import dotty .tools .dotc
8
8
import dotty .tools .dotc .core .Contexts ._
9
- import dotty .tools .dotc .core .Contexts ._
10
9
import dotty .tools .dotc .core .StdNames .nme
11
10
12
11
/** Matches a quoted tree against a quoted pattern tree.
@@ -378,17 +377,19 @@ object Matcher {
378
377
private object ClosedPatternTerm {
379
378
/** Matches a term that does not contain free variables defined in the pattern (i.e. not defined in `Env`) */
380
379
def unapply (term : Term )(using Env ): Option [term.type ] =
381
- if freePatternVars(term).isEmpty then Some (term) else None
380
+ if freePatternVars(term. asInstanceOf ).isEmpty then Some (term) else None
382
381
383
382
/** Return all free variables of the term defined in the pattern (i.e. defined in `Env`) */
384
- def freePatternVars (term : Term )(using env : Env ): Set [Symbol ] =
383
+ def freePatternVars (term : dotc.ast.tpd.Tree )(using env : Env ): Set [dotc.core.Symbols .Symbol ] =
384
+ import dotc .ast .tpd .* // TODO remove
385
+ import dotc .core .Symbols .* // TODO remove
385
386
val accumulator = new TreeAccumulator [Set [Symbol ]] {
386
- def foldTree (x : Set [Symbol ], tree : Tree )(owner : Symbol ): Set [Symbol ] =
387
+ def apply (x : Set [Symbol ], tree : Tree )(using Context ): Set [Symbol ] =
387
388
tree match
388
- case tree : Ident if env.contains(tree.symbol) => foldOverTree (x + tree.symbol, tree)(owner )
389
- case _ => foldOverTree (x, tree)(owner )
389
+ case tree : Ident if env.contains(tree.symbol. asInstanceOf ) => foldOver (x + tree.symbol, tree)
390
+ case _ => foldOver (x, tree)
390
391
}
391
- accumulator.foldTree (Set .empty, term)( Symbol .spliceOwner )
392
+ accumulator.apply (Set .empty, term)
392
393
}
393
394
394
395
private def treeOptMatches (scrutinee : Option [Tree ], pattern : Option [Tree ])(using Env ): Matching = {
0 commit comments