From 9ee8c5d253caa0efd6a7a77025585e928be34075 Mon Sep 17 00:00:00 2001 From: noti0na1 Date: Thu, 6 Jun 2024 14:24:15 +0200 Subject: [PATCH] Fix error related to reaches --- tests/neg/i20503.scala | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/neg/i20503.scala b/tests/neg/i20503.scala index 23212667051b..7a1bffcff529 100644 --- a/tests/neg/i20503.scala +++ b/tests/neg/i20503.scala @@ -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