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
Briefly,
* The ability to declare type aliases that share names with associated types in protocol extensions results in broken conformances and modified protocols down the whole protocol hierarchy. (All further occurrences of the associated type in the protocol hierarchy will refer to the {{typealias}} instead).
* A similar situation happens when declaring a {{typealias}} in an extension of a type that conforms to a protocol with an equally named and same-type constrained {{associatedtype}}
Code snippets, respectively
protocolP {
associatedtypeE = Stringfuncfoo1(_arg: E)
funcfoo2(_arg: E)
}
protocolP1: P \{...} // (*) See bottom lineclassFoo: P {
funcfoo1(_arg: E) {}
funcfoo2(_arg: E) {}
}
extensionP \{ typealiasE = Bool } // This will break Foo...// ...and any conformances down the whole protocol hierarchy// (*) All further occurrences of E will refer to the typealias instead.
protocolP {
associatedtypeA = Stringfuncfoo(_arg: A)
}
classFoo: P {
funcfoo(_arg: A) {}
}
extensionFoo {
typealiasA = Bool
}
// No redeclaration error and conformance is broken
The text was updated successfully, but these errors were encountered:
usagi did this for no apparent reason.. The funny thing is it looks like he translated the web page and then pasted that in rather than doing so thoughtfully.
Environment
Xcode Version 9.2 (9C40b)
Additional Detail from JIRA
md5: 85ce0f52f6ac8fa0af9e0c00aab5db93
Issue Description:
I described the issue in [this\|https://forums.swift.org/t/source-breaking-ability-to-override-associated-type-in-protocol-extension/11538] thread.
Briefly,
* The ability to declare type aliases that share names with associated types in protocol extensions results in broken conformances and modified protocols down the whole protocol hierarchy. (All further occurrences of the associated type in the protocol hierarchy will refer to the {{typealias}} instead).
* A similar situation happens when declaring a {{typealias}} in an extension of a type that conforms to a protocol with an equally named and same-type constrained {{associatedtype}}
Code snippets, respectively
The text was updated successfully, but these errors were encountered: