tut
tut copied to clipboard
tut:fail is failing
The following code taken verbatim from some documentation I'm trying to tut:fail
import concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global
def something[A](futL: Future[List[Int]])(f: Int => A): Future[List[A]] = for{
list <- futL
item <- list //won't compile since "list" isn't a Future and hence, doesn't compose!
} yield f(item)
gives me the following output:
[tut] *** Error reported at Transformers.md:17: failure was asserted but no failure occurred
import concurrent.Future
[tut] *** Error reported at Transformers.md:18: failure was asserted but no failure occurred
import scala.concurrent.ExecutionContext.Implicits.global
I'm assuming this is a bug or is it supposed to be overeager? Removing the :fail
causes the expected compilation errors.
Ah, yeah. Hell. The way it's written fail
expects every statement in the block to fail. My tests were all examples with a single expression. For now you can fix it by breaking it into two blocks.
I see there's a :paste
option, could that be combined with :fail
to, in essence, get the desired result? If so, can close issue.
Yes, good point. I think so, but let's leave this open for now.
To be clear there is not yet a :paste
option.