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
Currently, the only alternative is to disable this rule entirely, for all types, everywhere. That's less than ideal: I'd like to enable this rule and to use shorthand names when they really are just shorthands.
The text was updated successfully, but these errors were encountered:
…are true:
* It is the type of a variable (file-, function-, or type-scoped)
* It is mutable (`var`, not `let`)
* It is not a computed property
* It does not have an initializer expression
If all of these are true, shortening it to `T?` would introduce a useless
nil-initialization that can be problematic in situations that want to
optimize performance (see https://forums.swift.org/t/what-is-a-variable-initialization-expression/52132).
Fixesapple#304.
allevato
added a commit
to allevato/swift-format
that referenced
this issue
Sep 16, 2022
…are true:
* It is the type of a variable (file-, function-, or type-scoped)
* It is mutable (`var`, not `let`)
* It is not a computed property
* It does not have an initializer expression
If all of these are true, shortening it to `T?` would introduce a useless
nil-initialization that can be problematic in situations that want to
optimize performance (see https://forums.swift.org/t/what-is-a-variable-initialization-expression/52132).
Fixesapple#304.
allevato
added a commit
to allevato/swift-format
that referenced
this issue
Sep 16, 2022
…are true:
* It is the type of a variable (file-, function-, or type-scoped)
* It is mutable (`var`, not `let`)
* It is not a computed property
* It does not have an initializer expression
If all of these are true, shortening it to `T?` would introduce a useless
nil-initialization that can be problematic in situations that want to
optimize performance (see https://forums.swift.org/t/what-is-a-variable-initialization-expression/52132).
Fixesapple#304.
Additional Detail from JIRA
md5: 640847747f502d1efb6fc7028d0cd127
Issue Description:
It isn't always just a shorthand; it can have meaningfully different behaviour. See: SR-11777 7 and discussion at https://forums.swift.org/t/what-is-a-variable-initialization-expression/52132
Currently, the only alternative is to disable this rule entirely, for all types, everywhere. That's less than ideal: I'd like to enable this rule and to use shorthand names when they really are just shorthands.
The text was updated successfully, but these errors were encountered: