Skip to content

Commit cf54d1d

Browse files
committed
Don't drop empty capture sets of capability classes
We need a way to distinguish C^{} and C^{cap} when printing. We print C^{cap} as C is C is a capability class.
1 parent d40f1f9 commit cf54d1d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ object CapturingType:
3434
*/
3535
def apply(parent: Type, refs: CaptureSet, boxed: Boolean = false)(using Context): Type =
3636
assert(!boxed || !parent.derivesFrom(defn.Caps_CapSet))
37-
if refs.isAlwaysEmpty && !refs.keepAlways then parent
37+
if refs.isAlwaysEmpty && !refs.keepAlways && !parent.derivesFromCapability then
38+
parent
3839
else parent match
3940
case parent @ CapturingType(parent1, refs1) if boxed || !parent.isBoxed =>
4041
apply(parent1, refs ++ refs1, boxed)

0 commit comments

Comments
 (0)