Closed foscomputerservices closed 1 year ago
There seems to be an issue when hoisting try out of expressions embedded in strings. Take the following code for example:
embedded
public struct TestHoistTry { public init() throws { print("Hello \(try Foo.tryMe())") } } struct Foo { static func tryMe() throws -> String { ", World!" } }
After running swiftlint we get the following:
public struct TestHoistTry { public init() throws { print("Hello \try (Foo.tryMe())") // <- try was lifted to the \ } } enum Foo { static func tryMe() throws -> String { ", World!" } }
% swiftformat --version 0.51.2
% swift --version swift-driver version: 1.62.15 Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51) Target: arm64-apple-macosx13.0
% xcodebuild -version Xcode 14.2 Build version 14C18
This has already been reported and will be fixed in the next release. Thanks!
@foscomputerservices fixed in 0.51.3
Issue
There seems to be an issue when hoisting try out of expressions
embedded
in strings. Take the following code for example:After running swiftlint we get the following:
Environment
% swiftformat --version 0.51.2
% swift --version swift-driver version: 1.62.15 Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51) Target: arm64-apple-macosx13.0
% xcodebuild -version Xcode 14.2 Build version 14C18