Skip to content

Commit

Permalink
add test case for scala#21507
Browse files Browse the repository at this point in the history
  • Loading branch information
Linyxus committed Aug 29, 2024
1 parent ea19290 commit a045b8c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/pos-custom-args/captures/i21507.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import language.experimental.captureChecking

trait Box[Cap^]:
def store(f: (() -> Unit)^{Cap^}): Unit

def run[Cap^](f: Box[Cap]^{Cap^} => Unit): Box[Cap]^{Cap^} =
new Box[Cap]:
private var item: () ->{Cap^} Unit = () => ()
def store(f: () ->{Cap^} Unit): Unit =
item = f // was error, now ok

0 comments on commit a045b8c

Please sign in to comment.