@@ -341,7 +341,7 @@ class SepCheck(checker: CheckCaptures.CheckerAPI) extends tpd.TreeTraverser:
341
341
* the latter contains a cap.
342
342
*/
343
343
private def formalCaptures (arg : Tree )(using Context ): Refs =
344
- arg.formalType.orElse(arg.nuType).deepCaptureSet .elems
344
+ arg.formalType.orElse(arg.nuType).spanCaptureSet .elems
345
345
346
346
/** The span capture set if the type of `tree` */
347
347
private def spanCaptures (tree : Tree )(using Context ): Refs =
@@ -402,7 +402,7 @@ class SepCheck(checker: CheckCaptures.CheckerAPI) extends tpd.TreeTraverser:
402
402
if clashIdx == 0 && ! isShowableMethod then " " // we already mentioned the type in `funStr`
403
403
else i " with type ${clashing.nuType}"
404
404
val hiddenSet = formalCaptures(polyArg).transHiddenSet
405
- val clashSet = deepCaptures(clashing)
405
+ val clashSet = if clashIdx == - 1 then deepCaptures(clashing) else spanCaptures (clashing)
406
406
val hiddenFootprint = hiddenSet.directFootprint
407
407
val clashFootprint = clashSet.directFootprint
408
408
report.error(
@@ -891,10 +891,11 @@ class SepCheck(checker: CheckCaptures.CheckerAPI) extends tpd.TreeTraverser:
891
891
val resultType = mtpe.finalResultType
892
892
val resultCaptures =
893
893
(resultArgCaptures(resultType) ++ resultType.deepCaptureSet.elems).filter(! isLocalRef(_))
894
+ // See i23726.scala why deepCaptureSet is needed here.
894
895
val resultPeaks = resultCaptures.allPeaks
895
896
capt.println(i " deps for $app = ${deps.toList}" )
896
897
(deps, resultPeaks)
897
-
898
+ end dependencies
898
899
899
900
/** Decompose an application into a function prefix and a list of argument lists.
900
901
* If some of the arguments need a separation check because they are capture polymorphic,
0 commit comments