SR-142 mutating function in protocol extension erroneously requires var declaration of class variables
Issue Description:
I really hate to waste the Swift team's time and distract you from more important things, so if this issue is an intentional restriction of the language then please feel free to archive this "bug" and not respond in any way. Here is the code which doesn't compile even though I wish it did:
protocolA {
vara: Int { getset }
}
extensionA {
varconvenientAccessor: Int {
get { returna }
set { a = newValue }
}
}
classB: A {
vara: Int = 0
}
funcacceptsB (instance: B) {
instance.a = 1// This compilesinstance.convenientAccessor = 2// This does not
}
The text was updated successfully, but these errors were encountered:
jeremyabannister commentedSep 20, 2018
Additional Detail from JIRA
md5: a287be58d0bdbdb7b069381c1a1f5ce1
duplicates:
var
declaration of class variablesIssue Description:
I really hate to waste the Swift team's time and distract you from more important things, so if this issue is an intentional restriction of the language then please feel free to archive this "bug" and not respond in any way. Here is the code which doesn't compile even though I wish it did:
The text was updated successfully, but these errors were encountered: