Skip to content

Commit 7c5dedd

Browse files
committed
Remove duplicated code
1 parent d3b61dd commit 7c5dedd

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,10 @@ object QuoteMatcher {
124124

125125
private def withEnv[T](env: Env)(body: Env ?=> T): T = body(using env)
126126

127-
def termMatch(scrutineeTerm: Tree, patternTerm: Tree)(using Context): Option[Tuple] =
127+
def treeMatch(scrutineeTerm: Tree, patternTerm: Tree)(using Context): Option[Tuple] =
128128
given Env = Map.empty
129129
scrutineeTerm =?= patternTerm
130130

131-
def typeTreeMatch(scrutineeTypeTree: Tree, patternTypeTree: Tree)(using Context): Option[Tuple] =
132-
given Env = Map.empty
133-
scrutineeTypeTree =?= patternTypeTree
134-
135131
/** Check that all trees match with `mtch` and concatenate the results with &&& */
136132
private def matchLists[T](l1: List[T], l2: List[T])(mtch: (T, T) => Matching): Matching = (l1, l2) match {
137133
case (x :: xs, y :: ys) => mtch(x, y) &&& matchLists(xs, ys)(mtch)

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2935,11 +2935,8 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
29352935
ctx1.gadt.addToConstraint(typeHoles)
29362936
ctx1
29372937

2938-
val matchings =
2939-
if pat1.isType then QuoteMatcher.termMatch(scrutinee, pat1)(using ctx1)
2940-
else QuoteMatcher.termMatch(scrutinee, pat1)(using ctx1)
2938+
val matchings = QuoteMatcher.treeMatch(scrutinee, pat1)(using ctx1)
29412939

2942-
// val matchings = matcher.termMatch(scrutinee, pattern)
29432940
if typeHoles.isEmpty then matchings
29442941
else {
29452942
// After matching and doing all subtype checks, we have to approximate all the type bindings

0 commit comments

Comments
 (0)