我最近升级到 Scala 2.13,现在被警告弃用。我的功能如下所示:
implicit def convertGeneralResult[A <% ToResponseMarshallable, B <% ToResponseMarshallable](r: Either[A, B]) =
r.fold[ToResponseMarshallable](identity, identity)
弃用警告显示(我实际上有两个,每个类型参数 A/B 一个):
视图边界已弃用;改用隐式参数。
示例:而不是def f[A <% Int](a: A)
使用def f[A](a: A)(implicit ev: A => Int)
不过,我不完全确定如何在我的情况下应用建议的修复程序。