Skip to content

Commit d38f257

Browse files
committed
Add handling for classes deriving from Capability in capturing type logic
1 parent 797bbb7 commit d38f257

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,9 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI:
728728
else if cls.isPureClass then
729729
// is cls is known to be pure, nothing needs to be added to self type
730730
selfInfo
731+
else if cls.derivesFrom(defn.Caps_Capability) then
732+
CapturingType(cinfo.selfType, CaptureSet.csImpliedByCapability)
733+
// CapturingType(cinfo.selfType, CaptureSet.universal)
731734
else if !cls.isEffectivelySealed && !cls.baseClassHasExplicitNonUniversalSelfType then
732735
// assume {cap} for completely unconstrained self types of publicly extensible classes
733736
CapturingType(cinfo.selfType, CaptureSet.universal)

0 commit comments

Comments
 (0)