Skip to content

Commit

Permalink
Don't add ^ to singleton capabilities during Setup
Browse files Browse the repository at this point in the history
  • Loading branch information
odersky committed Jun 26, 2024
1 parent 87e34ed commit ec1e66d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/cc/Setup.scala
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI:
this(expandThrowsAlias(res, exc, Nil))
case t =>
// Map references to capability classes C to C^
if t.derivesFromCapability && t.typeSymbol != defn.Caps_Exists
if t.derivesFromCapability && !t.isSingleton && t.typeSymbol != defn.Caps_Exists
then CapturingType(t, CaptureSet.universal, boxed = false)
else normalizeCaptures(mapOver(t))
end toCapturing
Expand Down
13 changes: 13 additions & 0 deletions tests/pos-custom-args/captures/cap-problem.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import language.experimental.captureChecking

trait Suspend:
type Suspension

def resume(s: Suspension): Unit

import caps.Capability

trait Async(val support: Suspend) extends Capability

class CancelSuspension(ac: Async, suspension: ac.support.Suspension):
ac.support.resume(suspension)

0 comments on commit ec1e66d

Please sign in to comment.