async in scala : macro has not been expanded

asynchronous, macros, scala

Solution

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.)

Problem

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 ```

Original source