-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
associated type inferencebugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itself
Description
Previous ID | SR-8702 |
Radar | None |
Original Reporter | spiceginger (JIRA User) |
Type | Bug |
Attachment: Download
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Bug, AssociatedTypeInference |
Assignee | @DougGregor |
Priority | Medium |
md5: 6cf3588e15ef830d7b036a5692175ff4
Issue Description:
protocol AbstractFactory {
associatedtype ViewController: UIViewController
associatedtype Context
}
protocol Factory: AbstractFactory {
func build(with context: Context) -> ViewController
}
struct NavigationFactory: Factory { // This line error: Type 'NavigationFactory' does not conform to protocol 'AbstractFactory'. Compiler forces you to use typealias
func build(with context: Any?) -> UINavigationController {
return UINavigationController(nibName: nil, bundle: nil)
}
}
Moving `func build(with context: Context) -> ViewController` to the `AbstractFactory` protocol makes everything compile
Metadata
Metadata
Assignees
Labels
associated type inferencebugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itself