lihaoyi / autowire

Macros for simple/safe RPCs between Scala applications, including ScalaJS/ScalaJVM
378 stars 50 forks source link

Cannot find proxy for ... #75

Open Daxten opened 6 years ago

Daxten commented 6 years ago

Hi,

my AjaxClient has some dependencies, so I've made it a class and create it on demand with this method:

  def withFileMap[Trait](files: Map[String, File])(onProgress: Option[Double] => Callback = _ => Callback.empty,
                                                   progressNotComputable: Boolean => Callback = _ => Callback.empty): ClientProxy[Trait, Json, Decoder, Encoder] = new AjaxClient(files, onProgress, progressNotComputable)[Trait]

From time to time I get the following macro(?) error:

 Cannot find proxy for... 

Funny thing is, that I can fix it by not using lambdas

    .withSimpleOptionalFileList[WiredApi]("banner", state.selectedImageFile, onProgress = e => $.modState()) // Macro error
    def updateProgress(d: Option[Double]) = $.modState(_.copy(progress = d))
    .withSimpleOptionalFileList[WiredApi]("banner", state.selectedImageFile, onProgress = updateProgress) // no Macro error