Hello!
I have few protocols with associated types:
protocol Remote {
associatedtype Credentials: RemoteCredentials
static var url: URI { get }
static var name: String { get }
static var credentials: Credentials.Type { get }
}
protocol RemoteAuthenticating {
associatedtype Remote: App.Remote
func authenticate(with credentials: Remote.Credentials) throws ->
(RemoteUser, ResponseRepresentable?)
}
protocol RemoteAuthenticationServiceBuilder {
associatedtype Service: RemoteAuthenticating
// TODO: `Service.Remote` should be constrained to `Remote` but compiler
crashes
func authenticationService<Remote: App.Remote>(for: Remote.Type) ->
Service? // where Service.Remote == Remote
}
It works fine until I uncomment the last where statement
If I trying to constraint Service.Remote type compiler will crash with segfault
11
I can guess that it's a compiler bug, but maybe I’m using generics in wrong way?
_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users