File tree 1 file changed +9
-3
lines changed
compiler/src/dotty/tools/dotc/typer
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 {
1484
1484
}
1485
1485
1486
1486
/** 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 {
1488
1488
case mt : MethodType if mt.isImplicitMethod =>
1489
- stripImplicit(resultTypeApprox(mt))
1489
+ stripImplicit(resultTypeApprox(mt, wildcardOnly ))
1490
1490
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
1492
1498
case _ =>
1493
1499
tp
1494
1500
}
You can’t perform that action at this time.
0 commit comments