开发者

Continuations and implicit conversions

开发者 https://www.devze.com 2023-02-08 12:58 出处:网络
I was experimenting with continuations, and I came across a case that seems to suggest that @cpsParam thwarts implicit conversions.

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:

开发者_JAVA技巧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.


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!

0

精彩评论

暂无评论...
验证码 换一张
取 消