File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -1502,11 +1502,17 @@ trait Applications extends Compatibility {
1502
1502
}
1503
1503
1504
1504
/** Drop any leading implicit parameter sections */
1505
- def stripImplicit (tp : Type )(using Context ): Type = tp match {
1505
+ def stripImplicit (tp : Type , wildcardOnly : Boolean = false )(using Context ): Type = tp match {
1506
1506
case mt : MethodType if mt.isImplicitMethod =>
1507
- stripImplicit(resultTypeApprox(mt))
1507
+ stripImplicit(resultTypeApprox(mt, wildcardOnly ))
1508
1508
case pt : PolyType =>
1509
- pt.derivedLambdaType(pt.paramNames, pt.paramInfos, stripImplicit(pt.resultType)).asInstanceOf [PolyType ].flatten
1509
+ pt.derivedLambdaType(pt.paramNames, pt.paramInfos,
1510
+ stripImplicit(pt.resultType, wildcardOnly = true ))
1511
+ // can't use TypeParamRefs for parameter references in `resultTypeApprox`
1512
+ // since their bounds can refer to type parameters in `pt` that are not
1513
+ // bound by the constraint. This can lead to hygiene violations if subsequently
1514
+ // `pt` itself is added to the constraint. Test case is run/enrich-gentraversable.scala.
1515
+ .asInstanceOf [PolyType ].flatten
1510
1516
case _ =>
1511
1517
tp
1512
1518
}
You can’t perform that action at this time.
0 commit comments