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