Skip to content

Commit 0d6cde1

Browse files
committed
Try array for simplicity
1 parent f75130d commit 0d6cde1

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -458,16 +458,16 @@ class QuoteMatcher(debug: Boolean) {
458458
* only when they have empty bounds (>: Nothing <: Any)
459459
*/
460460
def matchTypeDef(sctypedef: TypeDef, pttypedef: TypeDef): MatchingExprs =
461-
inline def recur(tds: List[TypeDef], unwind: Int): MatchingExprs =
462-
if unwind == 0 then
461+
inline def recur(tds: Array[TypeDef], i: Int): MatchingExprs =
462+
if i == 2 then
463463
matched
464464
else
465-
tds.head match
466-
case TypeDef(_, TypeBoundsTree(lo, hi, EmptyTree))
467-
if lo.tpe.isNothingType && hi.tpe.isAny
468-
=> recur(tds.tail, unwind - 1)
465+
tds(i).rhs match
466+
case tbt: TypeBoundsTree
467+
if tbt.lo.tpe.isNothingType && tbt.hi.tpe.isAny && tbt.alias.isEmpty
468+
=> recur(tds, i + 1)
469469
case _ => notMatched
470-
recur(sctypedef :: pttypedef :: Nil, unwind = 2)
470+
recur(Array(sctypedef, pttypedef), i = 0)
471471

472472
def matchParamss(scparamss: List[ParamClause], ptparamss: List[ParamClause])(using Env): optional[(Env, MatchingExprs)] =
473473
(scparamss, ptparamss) match {

0 commit comments

Comments
 (0)