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 @@ -1484,11 +1484,17 @@ trait Applications extends Compatibility {
14841484 }
14851485
14861486 /** Drop any leading implicit parameter sections */
1487- def stripImplicit (tp : Type )(using Context ): Type = tp match {
1487+ def stripImplicit (tp : Type , wildcardOnly : Boolean = false )(using Context ): Type = tp match {
14881488 case mt : MethodType if mt.isImplicitMethod =>
1489- stripImplicit(resultTypeApprox(mt))
1489+ stripImplicit(resultTypeApprox(mt, wildcardOnly ))
14901490 case pt : PolyType =>
1491- pt.derivedLambdaType(pt.paramNames, pt.paramInfos, stripImplicit(pt.resultType)).asInstanceOf [PolyType ].flatten
1491+ pt.derivedLambdaType(pt.paramNames, pt.paramInfos,
1492+ stripImplicit(pt.resultType, wildcardOnly = true ))
1493+ // can't use TypeParamRefs for parameter references in `resultTypeApprox`
1494+ // since their bounds can refer to type parameters in `pt` that are not
1495+ // bound by the constraint. This can lead to hygiene violations if subsequently
1496+ // `pt` itself is added to the constraint. Test case is run/enrich-gentraversable.scala.
1497+ .asInstanceOf [PolyType ].flatten
14921498 case _ =>
14931499 tp
14941500 }
You can’t perform that action at this time.
0 commit comments