Skip to content

Commit 1c2a06e

Browse files
committed
Avoid hygiene violations in stripImplicit
1 parent c87c0f9 commit 1c2a06e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

compiler/src/dotty/tools/dotc/typer/Applications.scala

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,11 +1484,15 @@ 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 dependent types sinc ethey refer can refer to type parameters
1494+
// in `pt` that are not bound by the constraint. Test case is run/enrich-gentraversable.scala.
1495+
.asInstanceOf[PolyType].flatten
14921496
case _ =>
14931497
tp
14941498
}

0 commit comments

Comments
 (0)