@@ -201,14 +201,14 @@ object Matcher {
201
201
if patternHole.symbol.eq(defn.QuotedRuntimePatterns_patternHole ) &&
202
202
s.tpe <:< tpt.tpe &&
203
203
tpt2.tpe.derivesFrom(defn.RepeatedParamClass ) =>
204
- matched(quotes.reflect. TreeMethods .asExpr( scrutinee. asInstanceOf [quotes.reflect. Tree ]) )
204
+ matched(scrutinee)
205
205
206
206
/* Term hole */
207
207
// Match a scala.internal.Quoted.patternHole and return the scrutinee tree
208
208
case (ClosedPatternTerm (scrutinee), TypeApply (patternHole, tpt :: Nil ))
209
209
if patternHole.symbol.eq(defn.QuotedRuntimePatterns_patternHole ) &&
210
210
scrutinee.tpe <:< tpt.tpe =>
211
- matched(quotes.reflect. TreeMethods .asExpr( scrutinee. asInstanceOf [quotes.reflect. Tree ]) )
211
+ matched(scrutinee)
212
212
213
213
/* Higher order term hole */
214
214
// Matches an open term and wraps it into a lambda that provides the free variables
@@ -235,8 +235,8 @@ object Matcher {
235
235
ctx.owner,
236
236
MethodType (names)(
237
237
_ => argTypes, _ => resType),
238
- (meth, x) => TreeOps (bodyFn(x)).changeNonLocalOwners(meth. asInstanceOf ))
239
- matched(quotes.reflect. TreeMethods .asExpr( res. asInstanceOf [quotes.reflect. Tree ]) )
238
+ (meth, x) => TreeOps (bodyFn(x)).changeNonLocalOwners(meth))
239
+ matched(res)
240
240
241
241
//
242
242
// Match two equivalent trees
@@ -421,8 +421,11 @@ object Matcher {
421
421
private object Matching {
422
422
423
423
def notMatched : Matching = None
424
+
424
425
val matched : Matching = Some (Tuple ())
425
- def matched (x : Any ): Matching = Some (Tuple1 (x))
426
+
427
+ def matched (tree : Tree )(using Context ): Matching =
428
+ Some (Tuple1 (new ExprImpl (tree, SpliceScope .getCurrent)))
426
429
427
430
extension (self : Matching )
428
431
def asOptionOfTuple : Option [Tuple ] = self
0 commit comments