2016-03-30 2 views
0

Scalaでは、annotation.implicitNotFoundアノテーションのおかげで、暗黙的なものが見つからないときにコンパイラのエラーメッセージをカスタマイズできます。ScalaでimplicitNotFoundメッセージを継承する

派生クラスのなんらかの理由でこのimplicitNotFoundエラーメッセージを継承する方法はありますか?つまり、次のようなものです。

scala> import annotation.implicitNotFound 
import annotation.implicitNotFound 

scala> @implicitNotFound("custom message") trait Base[T] 
defined trait Base 

scala> trait Derived[T] extends Base[T] 
defined trait Derived 

scala> implicitly[Base[Int]] 
<console>:13: error: custom message 
     implicitly[Base[Int]] // my message above, cool 
       ^

scala> implicitly[Derived[Int]] 
<console>:14: error: could not find implicit value for parameter e: Derived[Int] 
     implicitly[Derived[Int]] // not my message 

答えて

0

単純な回答:これはサポートされていない機能です。

関連する問題