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
The initializer in the extension above first initialises x to 100, then reinitialises it to -100, even though x is a let property.
In my opinion, this is an incorrect behaviour. Even if it is correct, it is inconsistent with reinitializing let properties directly:
extensionS{init(b:Int){
x = b
x = b // error: immutable value 'self.x' may only be initialized once// fix-it: change 'let' to 'var' to make it mutable}}extensionS{init(c:Int){self.init(x: a)
x = a // error: 'let' property 'x' may not be initialized directly; use "self.init(...)" or "self = ..." insteadself.init(x:-a)}}
The text was updated successfully, but these errors were encountered:
Environment
macOS 12.2 Beta (21D5025f)
2021-12-23 trunk snapshot
Additional Detail from JIRA
md5: af38010f2cae0298846cbc04e355a443
Issue Description:
The following code currently produces no error:
The initializer in the extension above first initialises
x
to 100, then reinitialises it to -100, even thoughx
is alet
property.In my opinion, this is an incorrect behaviour. Even if it is correct, it is inconsistent with reinitializing
let
properties directly:The text was updated successfully, but these errors were encountered: