File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
compiler/src/scala/quoted/runtime/impl Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -383,6 +383,12 @@ object QuoteMatcher {
383
383
case scrutinee @ DefDef (_, paramss1, tpt1, _) =>
384
384
pattern match
385
385
case pattern @ DefDef (_, paramss2, tpt2, _) =>
386
+ def matchErasedParams (scrutinee : DefDef , pattern : DefDef ): optional[MatchingExprs ] =
387
+ (scrutinee.tpe.widenTermRefExpr, pattern.tpe.widenTermRefExpr) match
388
+ case (sctpe : MethodType , pttpe : MethodType ) =>
389
+ if sctpe.erasedParams.sameElements(pttpe.erasedParams) then matched else notMatched
390
+ case _ => notMatched
391
+
386
392
def matchParamss (scparamss : List [ParamClause ], ptparamss : List [ParamClause ])(using Env ): optional[(Env , MatchingExprs )] =
387
393
(scparamss, ptparamss) match {
388
394
case (scparams :: screst, ptparams :: ptrest) =>
@@ -394,9 +400,12 @@ object QuoteMatcher {
394
400
case _ => notMatched
395
401
}
396
402
403
+ val ematch = matchErasedParams(scrutinee, pattern)
397
404
val (pEnv, pmatch) = matchParamss(paramss1, paramss2)
398
405
val defEnv = pEnv + (scrutinee.symbol -> pattern.symbol)
399
- pmatch
406
+
407
+ ematch
408
+ &&& pmatch
400
409
&&& withEnv(defEnv)(tpt1 =?= tpt2)
401
410
&&& withEnv(defEnv)(scrutinee.rhs =?= pattern.rhs)
402
411
case _ => notMatched
You can’t perform that action at this time.
0 commit comments