Open filimo opened 2 weeks ago
@filimo I'm guessing the argument to Logger.info()
is an autoclosure or something? Unfortunately SwiftFormat can't detect this automatically so you have to manually exclude such cases using --selfrequired info
The --selfrequired logger.info provides a partial workaround, but the problem persists in contexts involving String(describing:).
After updating to SwiftFormat versions between 0.50.6 and 0.54.0, the
redundantSelf
rule incorrectly removes the explicit use ofself
in some contexts, which leads to compilation errors. The issue appears when using properties within closures or async contexts inactor
classes.Steps to Reproduce
self
explicitly.self
and the subsequent compilation error.Example
Before running SwiftFormat:
After running SwiftFormat:
Error:
Expected Behavior
SwiftFormat should recognize the context in which
self
is necessary for property access within closures or async methods and avoid removing it.Actual Behavior
The
redundantSelf
rule removes the necessaryself
prefix, causing a compilation error.Environment