Skip to content

Reach capabilities get dropped in cv #19571

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

Closed
Linyxus opened this issue Jan 31, 2024 · 1 comment
Closed

Reach capabilities get dropped in cv #19571

Linyxus opened this issue Jan 31, 2024 · 1 comment
Assignees
Labels
area:experimental:cc Capture checking related cc-experiment Intended to be merged with cc-experiment branch on origin itype:bug

Comments

@Linyxus
Copy link
Contributor

Linyxus commented Jan 31, 2024

Compiler version

main

Minimized code

import language.experimental.captureChecking
trait File:
  def write(x: String): Unit
def usingFile[R](op: File^ => R): R = ???
case class Box[+T](get: T)

def main(): Unit =
  val trick: Box[File^] -> Unit = (x: Box[File^]) =>
    val x1: Box[File^{x*}] = x
    val x2: File^{x*} = x.get
    x2.write("Hello")
  val bad: () -> Unit = usingFile[() -> Unit]: f =>
    val boxed: Box[File^] = Box(f)
    () => trick(boxed)
  bad()  // boom

Output

It compiles.

Expectation

It should not.

I am working on a fix.

@Linyxus Linyxus added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label cc-experiment Intended to be merged with cc-experiment branch on origin and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Jan 31, 2024
@Linyxus Linyxus self-assigned this Jan 31, 2024
@Gedochao Gedochao added the area:experimental:cc Capture checking related label Jan 31, 2024
@Linyxus
Copy link
Contributor Author

Linyxus commented Aug 7, 2024

Has been resolved.

@Linyxus Linyxus closed this as completed Aug 7, 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 cc-experiment Intended to be merged with cc-experiment branch on origin itype:bug
Projects
None yet
Development

No branches or pull requests

2 participants