Issue with the rule redundantInit
not playing nicely with preprocessor
#1624
Labels
redundantInit
not playing nicely with preprocessor
#1624
I love
swiftformat
and use it often, but unfortunately I came across an issue with the ruleredundantInit
.I had a struct that was defined something like this:
The issue is that when
SOMETHING
evaluates to true the special initializerinit(customType: CustomType)
is defined but that causes the swift compiler to no longer provide a synthesized initializer ifredundantInit
deletes the normal initializer which was provided explicitly so that it is accessible even when compiling with the flagSOMETHING
set to true.I know another way that would work with the current implementation of
redundantInit
would be to provide the initializerinit(customType: CustomType)
via an extension that is defined conditionally by the flagSOMETHING
....come to think of it this is cleaner perhaps but I still wanted to confirm if this is expected behavior or not.
Thanks!
The text was updated successfully, but these errors were encountered: