@@ -606,7 +606,7 @@ class CheckCaptures extends Recheck, SymTransformer:
606606
607607 /** Massage `actual` and `expected` types using the methods below before checking conformance */
608608 override def checkConformsExpr (actual : Type , expected : Type , tree : Tree )(using Context ): Unit =
609- val expected1 = makeFunctionDependent (addOuterRefs(expected, actual), actual.stripCapturing)
609+ val expected1 = alignDependentFunction (addOuterRefs(expected, actual), actual.stripCapturing)
610610 val actual1 = adaptBoxed(actual, expected1, tree.srcPos)
611611 // println(i"check conforms $actual1 <<< $expected1")
612612 super .checkConformsExpr(actual1, expected1, tree)
@@ -615,7 +615,8 @@ class CheckCaptures extends Recheck, SymTransformer:
615615 MethodType .companion(isContextual = isContextual, isErased = isErased)(args, resultType)
616616 .toFunctionType(isJava = false , alwaysDependent = true )
617617
618- private def makeFunctionDependent (expected : Type , actual : Type )(using Context ): Type =
618+ /** Turn `expected` into a dependent function when `actual` is dependent. */
619+ private def alignDependentFunction (expected : Type , actual : Type )(using Context ): Type =
619620 def recur (expected : Type ): Type = expected.dealias match
620621 case expected @ CapturingType (eparent, refs) =>
621622 CapturingType (recur(eparent), refs, boxed = expected.isBoxed)
0 commit comments