I am not sure as to why this simple code would lead to an error:
object Main {
def main(args: Array[String]) {
val userInterrupted: Future[String] = async {
var inp = await { Future.userInput("")}
"You entered... " + inp
}
}
}
The error message :
[error] /Users/reactive programming coursera/nodescala/src/main/scala/nodescala/Main.scala:18: macro has not been expanded
[error] val userInterrupted: Future[String] = async {
[error] ^
[error] one error found
[error] (assignment/compile:compile) Compilation failed
This seems to be a known problem (which has been fixed but probably won’t be available before Scala 2.11). As it’s got to do with the implicit, you can try to work around it by making the implicit explicit:
var inp = await { FutureCompanionOps(Future).userInput("") }
(As this question is related to the Coursera assignment, I know that you have defined an implicit class FutureCompanionOps[T]
which takes a type parameter and which appears to be the problem here.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With