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 {
15021502 }
15031503
15041504 /** 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 {
15061506 case mt : MethodType if mt.isImplicitMethod =>
1507- stripImplicit(resultTypeApprox(mt))
1507+ stripImplicit(resultTypeApprox(mt, wildcardOnly ))
15081508 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
15101516 case _ =>
15111517 tp
15121518 }
You can’t perform that action at this time.
0 commit comments