Closed
Description
Compiler version
3.6-NIGHTLY
Minimized code
//> using scala 3.6.0-RC1-bin-20240918-be10596-NIGHTLY
//> using dep org.scala-lang::scala2-library-cc-tasty-experimental:3.6.0-RC1-bin-20240918-be10596-NIGHTLY
import language.experimental.captureChecking
import caps.Capability
import caps.unbox
trait File extends Capability
case class Logger(f: File^) extends Capability // <- will work if we remove the extends clause
def mkLoggers(@unbox files: List[File^]): List[Logger^] = files.map(Logger(_))
@main def run = ()
Output
-- [E007] Type Mismatch Error: -------------------------------------------------
1 |def mkloggzer(@unbox files: List[File^]): List[Logger^] = files.map(Logger(_))
| ^^^^^^^^^
| Found: (caps.Exists -> Logger){
| def apply(ex$13: caps.Exists): Logger^{ex$13}; val f: File^{_$1}}^{_$1}
| Required: Logger{val f: File^?}^{_$1}
|
| Note that reference ex$13.type
| cannot be included in outer capture set {_$1}
|
| longer explanation available when compiling with `-explain`
1 error found
Expectation
The example should compile. It compiles if we omit extends Capability
for Logger
, but I would expect that Logger
should be tracked as a capability.