@@ -5496,8 +5496,21 @@ object Types {
5496
5496
stop == StopAt .Static && tp.currentSymbol.isStatic && isStaticPrefix(tp.prefix)
5497
5497
|| stop == StopAt .Package && tp.currentSymbol.is(Package )
5498
5498
}
5499
+
5500
+ protected def tyconTypeParams (tp : AppliedType )(using Context ): List [ParamInfo ] =
5501
+ tp.tyconTypeParams
5499
5502
end VariantTraversal
5500
5503
5504
+ trait ConstraintAwareTraversal extends VariantTraversal :
5505
+ override def tyconTypeParams (tp : AppliedType )(using Context ): List [ParamInfo ] =
5506
+ tp.tycon match
5507
+ case tycon : TypeParamRef =>
5508
+ ctx.typerState.constraint.entry(tycon) match
5509
+ case _ : TypeBounds =>
5510
+ case tp1 => if tp1.typeParams.nonEmpty then return tp1.typeParams
5511
+ case _ =>
5512
+ tp.tyconTypeParams
5513
+
5501
5514
/** A supertrait for some typemaps that are bijections. Used for capture checking.
5502
5515
* BiTypeMaps should map capture references to capture references.
5503
5516
*/
@@ -5613,7 +5626,7 @@ object Types {
5613
5626
derivedSelect(tp, prefix1)
5614
5627
5615
5628
case tp : AppliedType =>
5616
- derivedAppliedType(tp, this (tp.tycon), mapArgs(tp.args, tp. tyconTypeParams))
5629
+ derivedAppliedType(tp, this (tp.tycon), mapArgs(tp.args, tyconTypeParams(tp) ))
5617
5630
5618
5631
case tp : LambdaType =>
5619
5632
mapOverLambda(tp)
@@ -5940,7 +5953,7 @@ object Types {
5940
5953
case nil =>
5941
5954
true
5942
5955
}
5943
- if (distributeArgs(args, tp. tyconTypeParams))
5956
+ if (distributeArgs(args, tyconTypeParams(tp) ))
5944
5957
range(tp.derivedAppliedType(tycon, loBuf.toList),
5945
5958
tp.derivedAppliedType(tycon, hiBuf.toList))
5946
5959
else if tycon.isLambdaSub || args.exists(isRangeOfNonTermTypes) then
@@ -6086,7 +6099,7 @@ object Types {
6086
6099
}
6087
6100
foldArgs(acc, tparams.tail, args.tail)
6088
6101
}
6089
- foldArgs(this (x, tycon), tp. tyconTypeParams, args)
6102
+ foldArgs(this (x, tycon), tyconTypeParams(tp) , args)
6090
6103
6091
6104
case _ : BoundType | _ : ThisType => x
6092
6105
0 commit comments