You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Swift 5 now allows CRTP. It would be great if CRTP constraints could be formed with associated types of a protocol.
classGeneric<T> {}
protocolP {
// CRTP with the associated type.// I read this as: the conforming type should have a type `A` that// is a sub-class of `Generic<A>` (CRTP).associatedtypeA: Generic<A> // error: Superclass constraint 'Self.A' : 'Generic<Self.A>' is recursive
}
Environment
Apple Swift version 5.0 (swiftlang-1001.0.69.5 clang-1001.0.46.3)
Target: x86_64-apple-darwin18.2.0
Additional Detail from JIRA
md5: f91bc71aa7e500ee429bed09cb3a6ba2
Issue Description:
Swift 5 now allows CRTP. It would be great if CRTP constraints could be formed with associated types of a protocol.
Forum thread: https://forums.swift.org/t/why-is-this-super-class-constraint-recursive/22340
The text was updated successfully, but these errors were encountered: