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
OS X 10.11.6 (15G1217)
Xcode Version 8.2.1 (8C1002)
Additional Detail from JIRA
Votes
0
Component/s
Compiler
Labels
Bug
Assignee
None
Priority
Medium
md5: 160ee33eef73361ca49d17b79be58103
is duplicated by:
SR-11298 Writable property declaration in a conditional-conforming protocol extension has incorrect mutability
relates to:
SR-142 mutating function in protocol extension erroneously requires var declaration of class variables
Issue Description:
In this scenario:
protocol CoolProtocol {
var coolness: Int { get set }
}
protocol CoolClassProtocol: class, CoolProtocol {
// if you re-declare coolness here all works as expected
// var coolness: Int { get set }
}
class Cool {
var coolness = 1
}
func incrementCool(_ cool: CoolClassProtocol) {
// here you get compiler error saying cool should be var.
// if you do it as in:
// var cool = cool
// you'll get a warning telling you that cool is never mutated and should be made a let constant.
cool.coolness += 1
}
The text was updated successfully, but these errors were encountered:
Environment
OS X 10.11.6 (15G1217)
Xcode Version 8.2.1 (8C1002)
Additional Detail from JIRA
md5: 160ee33eef73361ca49d17b79be58103
is duplicated by:
relates to:
var
declaration of class variablesIssue Description:
In this scenario:
The text was updated successfully, but these errors were encountered: