2011-02-03 56 views
1

我正在尝试延续,并且我遇到了一个似乎表明@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

是否有我犯的一个简单的错误?

谢谢, Topher。

回答

0

我找不到要定义_ ==方法的地方。但是你可能应该导入隐式转换方法,而不仅仅是类/特征/对象。这意味着,你应该写这样的事情:

import foo.bar.Bar.convert // OK

或本:

import foo.bar.Bar._ // OK

,而不是依据这个

import foo.bar.Bar // Bad: The implicit conversion method is not imported!

+0

的示例代码所带来的必要通过它扩展的特征/类来隐式地隐含到范围中。 – Topher 2011-02-28 13:23:24