2016-03-30 17 views
0

Scala'da, annotation.implicitNotFound ek açıklamaları sayesinde, örtük bulunamadığında derleyicinin hata iletisini özelleştirebiliriz.Scala'da implicitNotFound iletilerini iç içe geçirme

Türetilmiş sınıfların bu implicitNotFound hata iletisini devralması için bir yol var mı? Örneğin, böyle bir şey:

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 

cevap

0

Basit cevap: Bu desteklenen bir özellik değil gibi görünüyor.