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-964 Warn if a computed property setter doesn't reference the new value
Issue Description:
Another developer recently mentioned that he spent two hours debugging a problem that came down to a property like this:
varfoo: Foo {
set { underlyingComponent.foo = foo } // this should have been `= newValue` ...get { returnunderlyingComponent.foo }
}
The compiler could have diagnosed this mistake by noticing that the newValue parameter was never referenced in the setter. It is difficult to imagine a setter which would not need to reference its newValue, and on the off chance somebody really does need to do so, you could silence the warning by ignoring the parameter with "set (_) {…}".
The text was updated successfully, but these errors were encountered:
Additional Detail from JIRA
md5: 86f0040d2fe7629e764905b46d4f068f
duplicates:
Issue Description:
Another developer recently mentioned that he spent two hours debugging a problem that came down to a property like this:
The compiler could have diagnosed this mistake by noticing that the newValue parameter was never referenced in the setter. It is difficult to imagine a setter which would not need to reference its newValue, and on the off chance somebody really does need to do so, you could silence the warning by ignoring the parameter with "set (_) {…}".
The text was updated successfully, but these errors were encountered: