Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reach capabilities of function arguments get ignored #20503

Closed
Linyxus opened this issue May 31, 2024 · 1 comment · Fixed by #20524
Closed

Reach capabilities of function arguments get ignored #20503

Linyxus opened this issue May 31, 2024 · 1 comment · Fixed by #20524
Assignees
Labels
area:experimental:cc Capture checking related itype:bug
Milestone

Comments

@Linyxus
Copy link
Contributor

Linyxus commented May 31, 2024

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.

@Linyxus Linyxus added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label area:experimental:cc Capture checking related and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels May 31, 2024
@Linyxus
Copy link
Contributor Author

Linyxus commented May 31, 2024

related: #19571, cc @odersky

@odersky odersky self-assigned this Jun 4, 2024
odersky added a commit to dotty-staging/dotty that referenced this issue Jun 4, 2024
@Kordyjan Kordyjan added this to the 3.5.1 milestone Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:experimental:cc Capture checking related itype:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants