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
SR-6980 Swift 4.1 new warning "Cannot override with a stored property"
Issue Description:
Given classes A and B like this:
classA {
varx: Int { return9 }
funcp() { print(x) }
}
classB: A {
...
}
letv: A = B()
v.p()
overriding x in B in three different ways have the following results:
classB: A {
// OPTION 1: FINE - prints 10overridevarx: Int { return10 }
// OPTION 2: ERROR - cannot override with a stored property 'x'overridevarx = 10// OPTION 3: FINE - prints 10overridelazyvarx = 10
}
As suggested in this answer there are cases in which overriding seems to be possible to be done without giving an error.
The text was updated successfully, but these errors were encountered:
Oh, cute—a lazy property is implemented behind the scenes as computed, so it sneaks past the check. Fixing that would break source compatibility at this point.
Additional Detail from JIRA
md5: 301431c66b14d31c641d261286db7903
relates to:
Issue Description:
Given classes A and B like this:
overriding x in B in three different ways have the following results:
As suggested in this answer there are cases in which overriding seems to be possible to be done without giving an error.
The text was updated successfully, but these errors were encountered: