[SR-2464] Reference types can't call mutating functions declared in a protocol extension. #45069
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Environment
Both Xcode Version 7.3.1 (7D1014) and Xcode Version 8.0 beta 6 (8S201h)
Additional Detail from JIRA
md5: ad869a2967de9d14c2e91b020106cb51
duplicates:
var
declaration of class variablesIssue Description:
Surprisingly, I can't find another bug open for this.
Suppose we have
We then declare a function in a protocol extension to clear our variable. The function must be mutating or else the variable can't be cleared.
We can both implement and consume this protocol from a value type
However the same is not true for a reference type
There is actually no real workaround to this example. In general, the func can be made non-mutating (which doesn't work here) or the protocol can be constrained to reference types (preventing
Qux
from implementing it), or the reference type can be converted to a value type (not for subclasses of NSViewController).The text was updated successfully, but these errors were encountered: