[SR-8153] Can no longer inherit from a typealias'd protocol composition containing AnyObject #50685
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
regression
swift 4.0
type checker
Area → compiler: Semantic analysis
Environment
Apple Swift version 3.1-dev (LLVM 9cb6a3ccee, Clang f38438fc01, Swift b5b79f8)
Target: x86_64-apple-macosx10.9
Apple Swift version 4.1.2 (swiftlang-902.0.54 clang-902.0.39.2)
Target: x86_64-apple-darwin17.6.0
Additional Detail from JIRA
md5: 8a66f8482ae9d01a49d646d0c08030b5
Issue Description:
In Swift 3.1, it was possible to inherit from a protocol composition containing AnyObject through a type alias:
However in Swift 4, both the above example in Swift 3 mode and the equivalent Swift 4 spelling no longer compile (presumably due to the fact that AnyObject is no longer an actual protocol):
I would argue that this is a useful feature to have – being able to have a list of protocol constraints in a typealias along with the requirement of being a class, and then being able to directly conform a class to this typealias.
Especially given the fact that this is legal:
The text was updated successfully, but these errors were encountered: