[SR-8595] Protocol extension on protocol with subclass where
restriction doesn't apply : class
semantics
#51111
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Environment
Xcode Version 10.0 beta 6 (10L232m), Apple Swift version 4.2 (swiftlang-1000.0.36 clang-1000.10.44)
(Also occurs in Swift 4.1.x)
Additional Detail from JIRA
md5: a35b960b5edfe17ce447790f7be32d57
duplicates:
Issue Description:
Consider a protocol with a class constraint:
protocol Fooable: class
I can add a protocol extension to
Fooable
with a property that has a setter, and use the setter on with reference semantics.let x = MyClass(); x.bar = "qux"
Now consider adding a where constraint to the protocol:
protocol Fooable where Self: UIViewController
.I am warned that marking the protocol `: class`, is redundant ("
Redundant constraint" 'Self': 'AnyObject
"), however, if I remove it I can no longer use the setter above with reference semantics ("Cannot assign to property: 'vc' is a 'let' constant
"). If I ignore the warning, the original code still works.The text was updated successfully, but these errors were encountered: