@@ -216,31 +216,21 @@ class InlineReducer(inliner: Inliner)(using Context):
216216 type TypeBindsMap = SimpleIdentityMap [TypeSymbol , java.lang.Boolean ]
217217
218218 def getTypeBindsMap (pat : Tree , tpt : Tree ): TypeBindsMap = {
219- val getBinds = new TreeAccumulator [Set [TypeSymbol ]] {
220- def apply (syms : Set [TypeSymbol ], t : Tree )(using Context ): Set [TypeSymbol ] = {
221- val syms1 = t match {
222- case t : Bind if t.symbol.isType =>
223- syms + t.symbol.asType
224- case _ => syms
225- }
226- foldOver(syms1, t)
227- }
228- }
229-
230219 // Extractors can contain Bind nodes in type parameter lists,
231220 // for that case tree looks like this:
232221 // UnApply[t @ t](pats)(implicits): T[t]
233222 // Test case is pos/inline-caseclass.scala.
223+ //
234224 // Alternatively, for explicitly specified type binds in type annotations like in
235225 // case A(B): A[t]
236226 // the tree will look like this:
237227 // Unapply[t](pats)(implicits) : T[t @ t]
238228 // and the binds will be found in the type tree instead
239229 // Test case is pos-macros/i15971
240- val tptBinds = getBinds( Set .empty[ TypeSymbol ], tpt)
230+ val tptBinds = tpt.bindTypeSymbols.toSet
241231 val binds : Set [TypeSymbol ] = pat match {
242232 case UnApply (TypeApply (_, tpts), _, _) =>
243- getBinds( Set .empty[ TypeSymbol ], tpts) ++ tptBinds
233+ tpts.flatMap(_.bindTypeSymbols).toSet ++ tptBinds
244234 case _ => tptBinds
245235 }
246236
0 commit comments