Compliance Redundancy Warning in Swift 4

I just migrated the Swift 3.1 project from Xcode 8.3.3 to Swift 4 / Xcode 9 GM. I managed to resolve most compiler warnings, but this is one, and I can not find any information related to this. Code compiled without warning in Xcode 8.3.3. I use fragments to illustrate the problem.

Warning Precise Warning

FirebaseArrayDelegate.swift:22:26: Redundant conformance constraint 'T': 'FirebaseModel' 

and refers to the declaration of func initialized (third line).

 public protocol FirebaseArrayDelegate: class { func update(with block: (()->Void)?) func initialized<T : FirebaseModel>(array: FirebaseArray<T>) func added<T : FirebaseModel>(child: T, at index: Int) func changed<T : FirebaseModel>(child: T, at index: Int) func removed<T : FirebaseModel>(child: T, at index: Int) func moved<T : FirebaseModel>(child: T, from oldIndex: Int, to newIndex: Int) func changedSortOrder() func cancelled(with error: Error) } 

FirebaseModel is defined as

 public protocol FirebaseModel: AnyObject, Equatable { init?(snapshot: DataSnapshot) var key: String { get } var ref: DatabaseReference { get } } 

and FirebaseArray as

 open class FirebaseArray<T : FirebaseModel>: NSObject, Collection 

Any idea what might trigger this warning, or maybe be a bug in Xcode 9 GM? Thanks!

+5
source share
1 answer

This is a bug in Swift, I hope it will be considered in the near future.

See: https://bugs.swift.org/browse/SR-6265

+1
source

Source: https://habr.com/ru/post/1271801/


All Articles