Closed
Description
Compiler version
Latest NIGHTLY.
Minimized code
import language.experimental.captureChecking
import caps._
trait Foo extends Capability
trait CaptureSet:
type C <: CapSet^
def capturePoly[C^](x: Foo^{C^}): Foo^{C^} = x
def capturePoly2(c: CaptureSet)(x: Foo^{c.C^}): Foo^{c.C^} = x
def test =
val x: Foo^ = ???
object X extends CaptureSet:
type C = CapSet^{x}
val y: Foo^{x} = capturePoly(x) // ok
val z: Foo^{x} = capturePoly2(X)(x) // error
Output
-- [E007] Type Mismatch Error: local/ccpaths.scala:19:35 -----------------------
19 | val z: Foo^{x} = capturePoly2(X)(x)
| ^
| Found: (x : Foo^)
| Required: Foo^{c.C^}
|
| longer explanation available when compiling with `-explain`
Expectation
It should be accepted.