Swift 5.6 and 1.4.3 cause sendable errors on stringConvertible
drekka opened this issue · 8 comments
Expected behavior
Packages that depend on SwiftLog 1.4.n should compile when package resolution updates SwiftLog from 1.4.2 to 1.4.3.
The discussion in #218 indicates to me that the developers thought adding Sendable would only produce a warning. Yet over here we are seeing compilation failures and errors being issued.
Actual behavior
Packages using Logger.MetadataValue.stringConvertable(CustomStringConvertible)
fail compilation if the passed CustomStringConvertible
is also not Sendable
.
Steps to reproduce
With an established package that uses SwiftLog 1.4.2 and something like:
logger.log(level: self.logLevel,"...",metadata: ["abc": .stringConvertible(value)])
where value
has not had Sendable
applied.
With 1.4.2 this would compile. With 1.4.3 it fails to compile. Placing an error on value
and indicating it has to conform to Sendable
.
If possible, minimal yet complete reproducer code (or URL to code)
Sorry, don't have anything I can give at this time.
SwiftLog version/commit hash
This only emits a warning on 5.7, I double checked:
swift-log: 1.4.3
Xcode: Version 14.0 beta 4 (14A5284h)
- What is the exact error you're getting?
- What exact versions and flags are you using?
- Are you using -warn-concurrency which would turn warnings like these into errors?
- If so, you're a bit jumping ahead; we don't support libraries not breaking in that (opt-in) mode. There will be many warnings what there are no workaround for in today's language, so I'd suggest not using this flag in projects unless "poking around".
Error:
- SwiftLog 1.4.3, Xcode 13.4.1: -
derekclarkson@DereksDigIOMBP Edna % xcrun --find swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift derekclarkson@DereksDigIOMBP Edna % xcrun swift -version swift-driver version: 1.45.2 Apple Swift version 5.6.1 (swiftlang-5.6.0.323.66 clang-1316.0.20.12)
- Brand new SPM based project so there's no project file.
- Haven't come across
-warn-concurrency
and all the compiling is done through Xcode so I don't where I'd add it even if I could. Some option in thePackage.swift
file perhaps. Anyway, not something I've done.
Oh no... this is very confusing, it seems to error on 5.6.x even though we reverted most Sendable
warnings on 5.6 but it is only a warning on 5.7.
It's very true we should not be breaking 5.6 users, so we'll have to do something about that... I'll investigate our options and fix this asap.
Right now you can: pin 1.4.2 or use Swift 5.7.
FYI @DougGregor
I prepared a fix for 5.6, we'll publish it shortly
Thanks @ktoso As this is a client project (who are still supporting iOS12) we are using release Xcode's so I'll pin at 1.4.2 until a patch version is released. All good here.
Cool. Will try it.
Released 1.4.4 to fix this - thanks for reporting!