2011-02-03 67 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