Skip to content

Commit c790007

Browse files
committed
Remove unused files and document root.scala
1 parent ee60b21 commit c790007

File tree

12 files changed

+84
-285
lines changed

12 files changed

+84
-285
lines changed

compiler/src/dotty/tools/dotc/cc/CaptureAnnotation.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ case class CaptureAnnotation(refs: CaptureSet, boxed: Boolean)(cls: Symbol) exte
4242
case cr: TermRef => ref(cr)
4343
case cr: TermParamRef => untpd.Ident(cr.paramName).withType(cr)
4444
case cr: ThisType => This(cr.cls)
45-
case root(_) => ref(defn.captureRoot.termRef)
45+
case root(_) => ref(root.cap)
4646
// TODO: Will crash if the type is an annotated type, for example `cap.rd`
4747
}
4848
val arg = repeated(elems, TypeTree(defn.AnyType))

compiler/src/dotty/tools/dotc/cc/CaptureOps.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ extension (tree: Tree)
218218
elems
219219
case _ =>
220220
if tree.symbol.maybeOwner == defn.RetainsCapAnnot
221-
then ref(defn.captureRoot.termRef) :: Nil
221+
then ref(root.cap) :: Nil
222222
else Nil
223223

224224
extension (tp: Type)

compiler/src/dotty/tools/dotc/cc/CaptureSet.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,14 +408,20 @@ object CaptureSet:
408408

409409
/** The universal capture set `{cap}` */
410410
def universal(using Context): CaptureSet =
411-
defn.captureRoot.termRef.singletonCaptureSet
411+
root.cap.singletonCaptureSet
412+
413+
/** The same as CaptureSet.universal but generated implicitly for
414+
* references of Capability subtypes
415+
*/
416+
def universalImpliedByCapability(using Context) =
417+
defn.universalCSImpliedByCapability
412418

413419
def fresh(owner: Symbol = NoSymbol)(using Context): CaptureSet =
414420
root.Fresh.withOwner(owner).singletonCaptureSet
415421

416422
/** The shared capture set `{cap.rd}` */
417423
def shared(using Context): CaptureSet =
418-
defn.captureRoot.termRef.readOnly.singletonCaptureSet
424+
root.cap.readOnly.singletonCaptureSet
419425

420426
/** Used as a recursion brake */
421427
@sharable private[dotc] val Pending = Const(SimpleIdentitySet.empty)

compiler/src/dotty/tools/dotc/cc/Existential.scala

Lines changed: 0 additions & 211 deletions
This file was deleted.

compiler/src/dotty/tools/dotc/cc/Fresh.scala

Lines changed: 0 additions & 26 deletions
This file was deleted.

compiler/src/dotty/tools/dotc/cc/Setup.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI:
373373
*/
374374
def stripImpliedCaptureSet(tp: Type): Type = tp match
375375
case tp @ CapturingType(parent, refs)
376-
if (refs eq defn.universalCSImpliedByCapability) && !tp.isBoxedCapturing =>
376+
if (refs eq CaptureSet.universalImpliedByCapability) && !tp.isBoxedCapturing =>
377377
parent
378378
case _ => tp
379379

@@ -401,7 +401,7 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI:
401401
&& !t.isSingleton
402402
&& (!sym.isConstructor || (t ne tp.finalResultType))
403403
// Don't add ^ to result types of class constructors deriving from Capability
404-
then CapturingType(t, defn.universalCSImpliedByCapability, boxed = false)
404+
then CapturingType(t, CaptureSet.universalImpliedByCapability, boxed = false)
405405
else normalizeCaptures(mapFollowingAliases(t))
406406

407407
def innerApply(t: Type) =

compiler/src/dotty/tools/dotc/cc/Synthetics.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ object Synthetics:
132132
val (pt: PolyType) = info: @unchecked
133133
val (mt: MethodType) = pt.resType: @unchecked
134134
val (enclThis: ThisType) = owner.thisType: @unchecked
135-
val paramCaptures = CaptureSet(enclThis, defn.captureRoot.termRef)
135+
val paramCaptures = CaptureSet(enclThis, root.cap)
136136
pt.derivedLambdaType(resType = MethodType(mt.paramNames)(
137137
mt1 => mt.paramInfos.map(_.capturing(paramCaptures)),
138138
mt1 => CapturingType(mt.resType, CaptureSet(enclThis, mt1.paramRefs.head))))
@@ -150,7 +150,7 @@ object Synthetics:
150150
def transformCompareCaptures =
151151
val (enclThis: ThisType) = symd.owner.thisType: @unchecked
152152
MethodType(
153-
defn.ObjectType.capturing(CaptureSet(defn.captureRoot.termRef, enclThis)) :: Nil,
153+
defn.ObjectType.capturing(CaptureSet(root.cap, enclThis)) :: Nil,
154154
defn.BooleanType)
155155

156156
symd.copySymDenotation(info = symd.name match

0 commit comments

Comments
 (0)