JetBrains / JetBrains/capture-points

enabling capture point for scala futures for expression.

Open
#6 2 comments 0 reactions 1 assignee Claimed by @niktrop View on GitHub
Dominant language
No language data
Stars
36
Forks
11
PR merge metrics
No merged PRs in 30d

Description

Hi,

I am not able to get capture points to work for scala for expression. Here is a sample code

Steps to reproduce

1. Import scala.xml into intellij async stacktrace and enable them
2. Debug the code and set the breakpoint mentioned

` import scala.concurrent.Future
import scala.util.{Failure, Success}
import scala.concurrent.ExecutionContext.Implicits.global


object App30 extends App { // . --> point-4

def getMilk(): String = { // --> point-2
val ans = "5 gallons of milk"
ans
}
def getFlour(): String =
{
val ans= "2 oz of flour"
ans
}

val milkFuture = Future { getMilk() }
val flourFuture = Future { getFlour() }

val resultFut = { // --> point-3
for {
milk <- milkFuture // breakpoint here --> point-1
flour <- flourFuture
result = milk + flour
} yield result
}

resultFut.onComplete{

case Success(answer) => println("The result of getting ingridents is " + answer)
case Failure(exception) => println("could not access future value")
}
}
`

Expected behavior

Debug flow point-1 followed by point-2

Actual

Debug flow point 1 to 3 to 4

Did I miss anything out there?

Thanks

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.