延续和隐式转换
我正在尝试延续,我遇到了一个案例,似乎表明 @cpsParam 阻碍了隐式转换。
我
def v: T @cpsParam[Unit, Unit]
// ...and then later
v must_== 42
// where must_== is from specs/mockito
收到编译器错误:
must_== is not a member of Int @cpsParam[Unit,Unit]
gist 上提供了更完整的代码示例。
我犯了一个简单的错误吗?
谢谢, 托弗。
I was experimenting with continuations, and I came across a case that seems to suggest that @cpsParam thwarts implicit conversions.
I have
def v: T @cpsParam[Unit, Unit]
// ...and then later
v must_== 42
// where must_== is from specs/mockito
I get the compiler error:
must_== is not a member of Int @cpsParam[Unit,Unit]
A more complete code sample is available on gist.
Is there a simple mistake I've made?
Thanks,
Topher.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找不到 Must_== 方法的定义位置。但是您可能应该导入隐式转换方法,而不仅仅是类/特征/对象。这意味着,您应该编写如下内容:
import foo.bar.Bar.convert // OK
或这样:
import foo.bar.Bar._ // OK
和不是这个
import foo.bar.Bar // 不好:未导入隐式转换方法!
I can't find where must_== method is defined. But you should probably import the implicit conversion method and not only the class/trait/object. It means, you should write something like this:
import foo.bar.Bar.convert // OK
or this:
import foo.bar.Bar._ // OK
and not this
import foo.bar.Bar // Bad: The implicit conversion method is not imported!