2
votes

I have been chasing the following issue for quite a while and am hoping someone with more experience on this than myself can help me resolve it.

In my test-case the exact error is as follows:

java.lang.IllegalArgumentException: Could not find proxy for val user: specs.BasicSpec#User in List(value user, method applyOrElse, , method $anonfun$new$97, value fiveLetterNames, method $anonfun$new$90, method $anonfun$new$20, value , class BasicSpec, package specs, package ) (currentOwner= value fiveLetterNames )

The test can be found here:

https://github.com/outr/reactify/blob/master/shared/src/test/scala/specs/BasicSpec.scala#L227

This is the offending Macro:

https://github.com/outr/reactify/blob/master/shared/src/main/scala/com/outr/reactify/Macros.scala#L72

Without more information from the error I'm at a loss how to resolve this. Any assistance is greatly appreciated.

1
Did you resolve this issue? I have the same compiler error. - Evgeny Veretennikov
@EvgenyVeretennikov I did, but it has been so long now I don't remember exactly what the problem was. I think it has to do with using references that are only available at runtime at compile-time. If you share some code I'd be happy to try and help. - darkfrog
both links are gone - tribbloid

1 Answers

2
votes

I had the same problem in my project. The solution is not to use the same "lambda"* in macros more than one time.

"lambda" is the following:

def macroSample[A, B](c: blackbox.Context)
                     (lambda: c.Expr[A => B] /* <- lambda */) = { ... }

p.s. actually I cannot see your original code right now. That's a solution working in my case