Skip to content

Commit ec1e66d

Browse files
committed
Don't add ^ to singleton capabilities during Setup
1 parent 87e34ed commit ec1e66d

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI:
317317
this(expandThrowsAlias(res, exc, Nil))
318318
case t =>
319319
// Map references to capability classes C to C^
320-
if t.derivesFromCapability && t.typeSymbol != defn.Caps_Exists
320+
if t.derivesFromCapability && !t.isSingleton && t.typeSymbol != defn.Caps_Exists
321321
then CapturingType(t, CaptureSet.universal, boxed = false)
322322
else normalizeCaptures(mapOver(t))
323323
end toCapturing
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import language.experimental.captureChecking
2+
3+
trait Suspend:
4+
type Suspension
5+
6+
def resume(s: Suspension): Unit
7+
8+
import caps.Capability
9+
10+
trait Async(val support: Suspend) extends Capability
11+
12+
class CancelSuspension(ac: Async, suspension: ac.support.Suspension):
13+
ac.support.resume(suspension)

0 commit comments

Comments
 (0)