在宏中找不到...的代理 [英] Could not find proxy for ... in Macro

查看:81
本文介绍了在宏中找不到...的代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在追问以下问题,希望有一个比我自己有更多经验的人可以帮助我解决问题.

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:在列表中找不到val用户的代理:specs.BasicSpec#User(值用户,方法applyOrElse,,方法$ anonfun $ new $ 97,值FiveLetterNames,方法$ anonfun $ new $ 90,方法$ anonfun $ new $ 20,value,类BasicSpec,软件包规格,package)(currentOwner = value FiveLetterNames)

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 )

可以在这里找到测试

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

这是令人反感的宏:

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.

推荐答案

我在项目中遇到了同样的问题.解决方案是不要在宏中多次使用相同的"lambda" *.

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

"lambda"如下:

"lambda" is the following:

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

p.s.实际上我现在看不到您的原始代码.就我而言,这是一种解决方案

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

这篇关于在宏中找不到...的代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆