Skip to content

Reach capabilities of function arguments get ignored #20503

Closed
@Linyxus

Description

@Linyxus

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions