scala - Ambiguous Class level and inherited method level ClassTag -
i have trait requires function classtag
trait foo[t] { def bar(a: list[t])(implicit ev: classtag[t]): unit }
now have class needs extend trait, has uses classtag other methods, e.g.
class myclass[t](implicit classtag: classtag[t]) extends foo[t] { override def bar(a: list[t])(implicit ev: classtag[t]): unit = { /* stuff */ } def other(p: map[string, t]) = /* other stuff need classtag */ }
when compiled error message along lines of:
error:scalac: ambiguous implicit values: both value classtag in class myclass of type scala.reflect.classtag[t] , value ev of type scala.reflect.classtag[t] match expected type scala.reflect.classtag[t]
is there way can accommodate both class level classtag , override method parent trait?
you can give same name both of them.
Comments
Post a Comment