Compiler version
main
Minimized code
import language.experimental.captureChecking
def runOps(ops: List[() => Unit]): Unit =
ops.foreach(op => op())
def main(): Unit =
val f: List[() => Unit] -> Unit = runOps // should be error
Output
It compiles.
Expectation
It should not, as runOps unboxes the list elements and executes them, so runOps should not be pure. Based on the theory, we should simply prevent runOps from typechecking.