Skip to content

Commit 9ee8c5d

Browse files
committed
Fix error related to reaches
1 parent 746b00b commit 9ee8c5d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tests/neg/i20503.scala

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
import language.experimental.captureChecking
2+
3+
class List[+A]:
4+
def head: A = ???
5+
def tail: List[A] = ???
6+
def map[B](f: A => B): List[B] = ???
7+
def foreach[U](f: A => U): Unit = ???
8+
def nonEmpty: Boolean = ???
9+
210
def runOps(ops: List[() => Unit]): Unit =
3-
ops.foreach(op => op())
11+
// See i20156, due to limitation in expressiveness of current system,
12+
// we cannot map over the list of impure elements.
13+
ops.foreach(op => op()) // error
414

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

0 commit comments

Comments
 (0)