@@ -605,6 +605,8 @@ class CheckCaptures extends Recheck, SymTransformer:
605
605
606
606
/** Adapt function type `actual`, which is `aargs -> ares` (possibly with dependencies)
607
607
* to `expected` type.
608
+ * It returns the adapted type along with the additionally captured variable
609
+ * during adaptation.
608
610
* @param reconstruct how to rebuild the adapted function type
609
611
*/
610
612
def adaptFun (actual : Type , aargs : List [Type ], ares : Type , expected : Type ,
@@ -633,6 +635,9 @@ class CheckCaptures extends Recheck, SymTransformer:
633
635
finally
634
636
curEnv = saved
635
637
638
+ /** Adapt type function type `actual` to the expected type.
639
+ * @see [[adaptFun ]]
640
+ */
636
641
def adaptTypeFun (
637
642
actual : Type , ares : Type , expected : Type ,
638
643
covariant : Boolean , boxed : Boolean ,
@@ -661,6 +666,13 @@ class CheckCaptures extends Recheck, SymTransformer:
661
666
val arrow = if covariant then " ~~>" else " <~~"
662
667
i " adapting $actual $arrow $expected"
663
668
669
+ /** Destruct a capturing type `tp` to a tuple (cs, tp0, boxed),
670
+ * where `tp0` is not a capturing type.
671
+ *
672
+ * If `tp` is a nested capturing type, the return tuple always represents
673
+ * the innermost capturing type. The outer capture annotations can be
674
+ * reconstructed with the returned function.
675
+ */
664
676
def destructCapturingType (tp : Type , reconstruct : Type => Type = x => x): ((Type , CaptureSet , Boolean ), Type => Type ) =
665
677
tp.dealias match
666
678
case tp @ CapturingType (parent, cs) =>
0 commit comments