generics - 被覆盖的方法具有与基方法的通用签名不兼容的通用签名
问题描述
我刚刚更新到 Xcode 11.4。我收到以下错误:
Overridden method 'equals' has generic signature <T where T : Gradient> which is incompatible with base method's generic signature <T where T : Fill>; expected generic signature to be <T where T : Fill>
class Fill: Equatable {
func equals<T>(other: T) -> Bool where T: Fill { }
}
func ==<T> (lhs: T, rhs: T) -> Bool where T: Fill {
return lhs.equals(other: rhs)
}
class Gradient: Fill {
override func equals<T>(other: T) -> Bool where T: Gradient { }
}
这是如何改变的?
解决方案
推荐阅读
- javascript - 如何访问firestore函数之外的整数
- wordpress - Wordpress fa-solid-900.woff2 它是如何工作的?
- typescript - 使用 Sequelize 和 NestJs 的多对一
- sql - 有没有办法根据 Postgres 中的计数器列重复行?
- flutter - Flutter integration_test - 初始化和处理依赖项
- shell - 根据shell脚本中的模式提取字符串
- python - 在客户端的信使框中点击“确定”,程序退出服务器端。(连接成功)
- python - 如何将python代码输出存储到csv文件
- php - 将网页的一部分保存为 html
- javascript - jquery - 单页应用程序