-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't treat user-defined capabilities deriving from caps.Capability as maximal. That was a vestige from when we treated capability classes natively. It caused code that should compile to fail because if `x extends Capability` then `x` could not be widened to `x*`. As a consequence we have one missed error in effect-swaps again, which re-establishes the original (faulty) situation.
- Loading branch information
Showing
6 changed files
with
57 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import language.experimental.captureChecking | ||
import annotation.experimental | ||
import caps.{CapSet, Capability} | ||
|
||
@experimental object Test: | ||
|
||
class Label extends Capability | ||
|
||
class Listener | ||
|
||
class Source[X^]: | ||
private var listeners: Set[Listener^{X^}] = Set.empty | ||
def register(x: Listener^{X^}): Unit = | ||
listeners += x | ||
|
||
def allListeners: Set[Listener^{X^}] = listeners | ||
|
||
def test1(lbl1: Label, lbl2: Label) = | ||
val src = Source[CapSet^{lbl1, lbl2}] | ||
def l1: Listener^{lbl1} = ??? | ||
val l2: Listener^{lbl2} = ??? | ||
src.register{l1} | ||
src.register{l2} | ||
val ls = src.allListeners | ||
val _: Set[Listener^{lbl1, lbl2}] = ls | ||
|
||
def test2(lbls: List[Label]) = | ||
def makeListener(lbl: Label): Listener^{lbl} = ??? | ||
val listeners = lbls.map(makeListener) | ||
val src = Source[CapSet^{lbls*}] | ||
for l <- listeners do | ||
src.register(l) | ||
val ls = src.allListeners | ||
val _: Set[Listener^{lbls*}] = ls | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import language.experimental.captureChecking | ||
import annotation.experimental | ||
import caps.{Capability} | ||
|
||
@experimental object Test2: | ||
|
||
class List[+A]: | ||
def map[B](f: A => B): List[B] = ??? | ||
|
||
class Label extends Capability | ||
|
||
class Listener | ||
|
||
def test2(lbls: List[Label]) = | ||
def makeListener(lbl: Label): Listener^{lbl} = ??? | ||
val listeners = lbls.map(makeListener) // should work | ||
|