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
Is there a rule such that we can force either .init() style or MyType() style initialization?
If not, would it be possible to create such a rule / formatter?
It's not possible to solve in the general case because SwiftFormat doesn't have access to non-local type information, so if you've written someFunction(.init()) I don't know the type of the argument and can't replace it with the type, and if you've written someFunction(Foo()), I don't know if the argument type was Foo or Any or some superclass or protocol that Foo conforms to, in which case replacing it with .init() wouldn't be valid.
Let's say we have a type, like a struct MyType.
Is there a rule such that we can force either
.init()
style orMyType()
style initialization?If not, would it be possible to create such a rule / formatter?
This looks slightly similar but is probably different https://github.com/nicklockwood/SwiftFormat/blob/main/Rules.md#redundantinit because it assumes that the type is always written out. This issue is for the cases where it's only written like
.init(
, thus letting the compiler infer the type.The text was updated successfully, but these errors were encountered: