Skip to content

Commit 78dfd29

Browse files
committed
Remove deadcode
1 parent ab060b2 commit 78dfd29

File tree

1 file changed

+5
-26
lines changed

1 file changed

+5
-26
lines changed

compiler/src/scala/quoted/runtime/impl/Matcher.scala

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,6 @@ object Matcher {
139139
case _ => notMatched
140140
}
141141

142-
extension (scrutinees: List[Tree])
143-
/** Check that all trees match with =?= and concatenate the results with &&& */
144-
private def =?= (patterns: List[Tree])(using Env): Matching =
145-
matchLists(scrutinees, patterns)(_ =?= _)
146-
147142
extension (scrutinee: Tree)
148143
private def =?= (pattern: Tree)(using Env): Matching =
149144
scrutinee.asInstanceOf[tpd.Tree] =?= pattern.asInstanceOf[tpd.Tree]
@@ -156,7 +151,7 @@ object Matcher {
156151
/** Check that the trees match and return the contents from the pattern holes.
157152
* Return None if the trees do not match otherwise return Some of a tuple containing all the contents in the holes.
158153
*
159-
* @param scrutinee The tree beeing matched
154+
* @param scrutinee The tree being matched
160155
* @param pattern The pattern tree that the scrutinee should match. Contains `patternHole` holes.
161156
* @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`.
162157
* @return `None` if it did not match or `Some(tup: Tuple)` if it matched where `tup` contains the contents of the holes.
@@ -382,21 +377,13 @@ object Matcher {
382377

383378
end extension
384379

385-
extension (scrutinee: ParamClause)
386-
/** Check that all parameters in the clauses clauses match with =?= and concatenate the results with &&& */
387-
private def =?= (pattern: ParamClause)(using Env)(using DummyImplicit): Matching =
388-
(scrutinee, pattern) match
389-
case (TermParamClause(params1), TermParamClause(params2)) => matchLists(params1, params2)(_ =?= _)
390-
case (TypeParamClause(params1), TypeParamClause(params2)) => matchLists(params1, params2)(_ =?= _)
391-
case _ => notMatched
392-
393380
/** Does the scrutenne symbol match the pattern symbol? It matches if:
394381
* - They are the same symbol
395382
* - The scrutinee has is in the environment and they are equivalent
396383
* - The scrutinee overrides the symbol of the pattern
397384
*/
398-
private def symbolMatch(scrutineeTree: dotc.ast.tpd.Tree, patternTree: dotc.ast.tpd.Tree)(using Env): Boolean =
399-
import dotc.ast.tpd.* // TODO remove
385+
private def symbolMatch(scrutineeTree: tpd.Tree, patternTree: tpd.Tree)(using Env): Boolean =
386+
import tpd.* // TODO remove
400387
val scrutinee = scrutineeTree.symbol
401388

402389
def overridingSymbol(ofclazz: dotc.core.Symbols.Symbol): dotc.core.Symbols.Symbol =
@@ -413,7 +400,7 @@ object Matcher {
413400

414401

415402
devirtualizedScrutinee == pattern
416-
|| summon[Env].get(devirtualizedScrutinee.asInstanceOf).contains(pattern)
403+
|| summon[Env].get(devirtualizedScrutinee).contains(pattern)
417404
|| devirtualizedScrutinee.allOverriddenSymbols.contains(pattern)
418405

419406
private object ClosedPatternTerm {
@@ -428,20 +415,12 @@ object Matcher {
428415
val accumulator = new TreeAccumulator[Set[Symbol]] {
429416
def apply(x: Set[Symbol], tree: Tree)(using Context): Set[Symbol] =
430417
tree match
431-
case tree: Ident if env.contains(tree.symbol.asInstanceOf) => foldOver(x + tree.symbol, tree)
418+
case tree: Ident if env.contains(tree.symbol) => foldOver(x + tree.symbol, tree)
432419
case _ => foldOver(x, tree)
433420
}
434421
accumulator.apply(Set.empty, term)
435422
}
436423

437-
private def treeOptMatches(scrutinee: Option[Tree], pattern: Option[Tree])(using Env)(using DummyImplicit): Matching = {
438-
(scrutinee, pattern) match {
439-
case (Some(x), Some(y)) => x =?= y
440-
case (None, None) => matched
441-
case _ => notMatched
442-
}
443-
}
444-
445424
}
446425

447426
/** Result of matching a part of an expression */

0 commit comments

Comments
 (0)