-
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.
- Loading branch information
Showing
5 changed files
with
32 additions
and
3 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,25 @@ | ||
import caps.* | ||
|
||
trait Foo extends Capability | ||
|
||
trait CaptureSet: | ||
type C <: CapSet^ | ||
|
||
def capturePoly[C^](a: Foo^{C^}): Foo^{C^} = a | ||
def capturePoly2(c: CaptureSet)(a: Foo^{c.C^}): Foo^{c.C^} = a | ||
|
||
def test = | ||
val x: Foo^ = ??? | ||
val y: Foo^ = ??? | ||
|
||
object X extends CaptureSet: | ||
type C = CapSet^{x} | ||
|
||
val z1: Foo^{X.C^} = x | ||
val z2: Foo^{X.C^} = y // error | ||
|
||
val z3: Foo^{x} = capturePoly(x) | ||
val z4: Foo^{x} = capturePoly(y) // error | ||
|
||
val z5: Foo^{x} = capturePoly2(X)(x) | ||
val z6: Foo^{x} = capturePoly2(X)(y) // error |