Closed heiberg closed 1 month ago
@heiberg I've not been able to reproduce this in 0.53.5 or 0.53.6. It's possible that the bug depends on some surrounding context - could you provide the whole method? (or whatever minimal code is needed to reproduce the problem in isolation)
Sure! Sorry for the delay, I missed the notification here.
class Hello {
func foo() {
nonisolated(unsafe) let `self` = self
}
}
swiftformat --swiftversion 5.10 Input.swift
Unchanged.
class Hello {
func foo() {
nonisolated(unsafe) let self = self
}
}
Unexpected change:
class Hello {
func foo() {
- nonisolated(unsafe) let `self` = self
+ nonisolated(unsafe) let self = self
}
}
SwiftFormat 0.53.5
@nicklockwood Was this issue reproducible given the above?
@heiberg sorry, I also missed this update. I believe the issue was that the issue only arises when --swiftversion
is set to 4.2 or above, so it wasn't showing up in my test case. I should have a fix shortly.
@heiberg fixed in 0.53.10
Description
Swift 5.10 (Xcode 15.3) introduced the
nonisolated(unsafe)
keyword.In the following line the backticks are required:
The
strongifiedSelf
rule strips these, which results in the errorNote that the example here is not strongifying a weak
self
, but rather declaring a non-isolated version ofself
(useful in certain test cases) .Environment