Open
Description
Compiler version
main
Minimized code
import language.experimental.captureChecking
import caps.*
final class Runner(val dummy: Int) extends AnyVal {
def runOps(@use ops: List[() => Unit]): Unit = ops.foreach(op => op()) // error
}
final class Runner1 {
def runOps(@use ops: List[() => Unit]): Unit = ops.foreach(op => op()) // ok
}
Output
-- Error: issues/cc-reach-ext.scala:5:61 ---------------------------------------
5 | def runOps(@use ops: List[() => Unit]): Unit = ops.foreach(op => op()) // error
| ^^^^^^^^^^
|Local reach capability ops* leaks into capture scope of method runOps$extension.
|To allow this, the parameter ops should be declared with a @use annotation
Expectation
Both runOps
methods should compile. Note that the only differences between them are whether they are a value class (whether it extends AnyVal
).