@@ -259,7 +259,7 @@ class CheckCaptures extends Recheck, SymTransformer:
259
259
* is that it is sometimes better for type inference to not constrain too early
260
260
* with a checkConformsExpr.
261
261
*/
262
- private var todoAtPostCheck = new mutable.ListBuffer [() => Unit ]
262
+ private val todoAtPostCheck = new mutable.ListBuffer [() => Unit ]
263
263
264
264
override def keepType (tree : Tree ) =
265
265
super .keepType(tree)
@@ -453,8 +453,8 @@ class CheckCaptures extends Recheck, SymTransformer:
453
453
val isVisible = c.pathRoot match
454
454
case ref : NamedType => isVisibleFromEnv(ref.symbol.owner, env)
455
455
case ref : ThisType => isVisibleFromEnv(ref.cls, env)
456
- case ref =>
457
- false
456
+ case ref => false
457
+
458
458
if ! isVisible then
459
459
if ccConfig.deferredReaches
460
460
then avoidLocalCapability(c, env, lastEnv)
@@ -603,22 +603,6 @@ class CheckCaptures extends Recheck, SymTransformer:
603
603
case _ => formal
604
604
funtpe.derivedLambdaType(paramInfos = paramInfosWithUses)
605
605
606
- /** If this is an application of a caps.unsafe method, handle it specially
607
- * otherwise return NoType.
608
- */
609
- private def recheckUnsafeApply (tree : Apply , pt : Type )(using Context ): Type =
610
- val meth = tree.fun.symbol
611
- if meth == defn.Caps_unsafeAssumePure then
612
- val arg :: Nil = tree.args: @ unchecked
613
- val argType0 = recheck(arg, pt.capturing(CaptureSet .universal))
614
- val argType =
615
- if argType0.captureSet.isAlwaysEmpty then argType0
616
- else argType0.widen.stripCapturing
617
- capt.println(i " rechecking $arg with $pt: $argType" )
618
- super .recheckFinish(argType, tree, pt)
619
- else NoType
620
- end recheckUnsafeApply
621
-
622
606
/** Recheck applications, with special handling of unsafeAssumePure.
623
607
* More work is done in `recheckApplication`, `recheckArg` and `instantiate` below.
624
608
*/
@@ -667,7 +651,7 @@ class CheckCaptures extends Recheck, SymTransformer:
667
651
* is the capture set of the argument.
668
652
* If the function `f` does have an `@use` parameter, then it could in addition
669
653
* unbox reach capabilities over its formal parameter. Therefore, the approximation
670
- * would be `Cq \union dcs(Ca )` instead.
654
+ * would be `Cq \union dcs(Ta )` instead.
671
655
* If the approximation might subcapture the declared result Cr, we pick it for C
672
656
* otherwise we pick Cr.
673
657
*/
@@ -741,7 +725,7 @@ class CheckCaptures extends Recheck, SymTransformer:
741
725
for (getterName, argType) <- mt.paramNames.lazyZip(argTypes) do
742
726
val getter = cls.info.member(getterName).suchThat(_.isRefiningParamAccessor).symbol
743
727
if ! getter.is(Private ) && getter.hasTrackedParts then
744
- refined = RefinedType (refined, getterName, argType.unboxed)
728
+ refined = RefinedType (refined, getterName, argType.unboxed) // Yichen you might want to check this
745
729
allCaptures ++= argType.captureSet
746
730
(refined, allCaptures)
747
731
@@ -783,7 +767,7 @@ class CheckCaptures extends Recheck, SymTransformer:
783
767
end recheckTypeApply
784
768
785
769
/** Faced with a tree of form `caps.contansImpl[CS, r.type]`, check that `R` is a tracked
786
- * capability and assert that `{r} <:CS`.
770
+ * capability and assert that `{r} <: CS`.
787
771
*/
788
772
def checkContains (tree : TypeApply )(using Context ): Unit = tree match
789
773
case ContainsImpl (csArg, refArg) =>
0 commit comments