@@ -260,7 +260,7 @@ object QuotePatterns:
260
260
fun match
261
261
// <quotes>.asInstanceOf[QuoteMatching].{ExprMatch,TypeMatch}.unapply[<typeBindings>, <resTypes>]
262
262
case TypeApply (Select (Select (TypeApply (Select (quotes, _), _), _), _), typeBindings :: resTypes :: Nil ) =>
263
- val bindings = unrollBindings (typeBindings)
263
+ val bindings = unrollHkNestedPairsTypeTree (typeBindings)
264
264
val addPattenSplice = new TreeMap {
265
265
private val patternIterator = patterns.iterator.filter {
266
266
case pat : Bind => ! pat.symbol.name.is(PatMatGivenVarName )
@@ -272,6 +272,10 @@ object QuotePatterns:
272
272
cpy.SplicePattern (tree)(patternIterator.next(), Nil , Nil )
273
273
case Apply (patternHole, SeqLiteral (args, _) :: Nil ) if patternHole.symbol == defn.QuotedRuntimePatterns_higherOrderHole =>
274
274
cpy.SplicePattern (tree)(patternIterator.next(), Nil , args)
275
+ case Apply (TypeApply (patternHole, List (_, targsTpe)), SeqLiteral (args, _) :: Nil ) if patternHole.symbol == defn.QuotedRuntimePatterns_higherOrderHoleWithTypes =>
276
+ // TODO-18271: error on ill-formed typed arguments?
277
+ // TODO-18271: test case?
278
+ cpy.SplicePattern (tree)(patternIterator.next(), unrollHkNestedPairsTypeTree(targsTpe), args)
275
279
case _ => super .transform(tree)
276
280
}
277
281
val body = addPattenSplice.transform(shape) match
@@ -289,7 +293,7 @@ object QuotePatterns:
289
293
case body => body
290
294
cpy.QuotePattern (tree)(bindings, body, quotes)
291
295
292
- private def unrollBindings (tree : Tree )(using Context ): List [Tree ] = tree match
296
+ private def unrollHkNestedPairsTypeTree (tree : Tree )(using Context ): List [Tree ] = tree match
293
297
case AppliedTypeTree (tupleN, bindings) if defn.isTupleClass(tupleN.symbol) => bindings // TupleN, 1 <= N <= 22
294
- case AppliedTypeTree (_, head :: tail :: Nil ) => head :: unrollBindings (tail) // KCons or *:
298
+ case AppliedTypeTree (_, head :: tail :: Nil ) => head :: unrollHkNestedPairsTypeTree (tail) // KCons or *:
295
299
case _ => Nil // KNil or EmptyTuple
0 commit comments