Skip to content

Commit

Permalink
Fix error related to reaches when using scala2-library-cc-tasty (#20528)
Browse files Browse the repository at this point in the history
Fix error introduced by a test of #20524.

Due to limitation in expressiveness of current system, we are not able
to map over lists of impure elements. See discussion in #20156.
  • Loading branch information
noti0na1 authored Jun 6, 2024
2 parents 746b00b + 9ee8c5d commit 27a3f80
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tests/neg/i20503.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
import language.experimental.captureChecking

class List[+A]:
def head: A = ???
def tail: List[A] = ???
def map[B](f: A => B): List[B] = ???
def foreach[U](f: A => U): Unit = ???
def nonEmpty: Boolean = ???

def runOps(ops: List[() => Unit]): Unit =
ops.foreach(op => op())
// See i20156, due to limitation in expressiveness of current system,
// we cannot map over the list of impure elements.
ops.foreach(op => op()) // error

def main(): Unit =
val f: List[() => Unit] -> Unit = runOps // error

0 comments on commit 27a3f80

Please sign in to comment.