pointfreeco / swift-perception

Observable tools, backported.
MIT License
574 stars 43 forks source link

Build warnings when including Perception project #59

Closed PatrickDanino closed 7 months ago

PatrickDanino commented 7 months ago

Description

New build warnings appeared with the latest update.

In Bindable, line 63:

Main actor-isolated property 'id' cannot be used to satisfy nonisolated protocol requirement

In Environment, lines 16, 27 and 46:

Cannot form key path that captures non-sendable type 'KeyPath<T, T>'

Checklist

Expected behavior

We're hoping the issues above can be resolved unless they are specific to Swift 5.9 and fixed in Swift 5.10.

Actual behavior

We generally treat build warnings as errors.

Steps to reproduce

Clean build a new project that includes Perception

Perception version information

1.1.5

Destination operating system

iOS 15

Xcode version information

15.2

Swift Compiler version information

swift-driver version: 1.87.3 Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)
Target: arm64-apple-macosx14.0
mbrandonw commented 7 months ago

Hi @PatrickDanino, the id warning is due to @ObservedObject implicitly "upgrading" the enclosing type to @MainActor. I believe this behavior is going away in Swift 6, and the key path one is a bug in Swift that will be fixed in Swift 6.

However, how is your project set up that you are seeing warnings for swift-perception? I created a fresh project with full concurrency warnings, added swift-perception, compiling, and I don't see any warnings. I tried in 15.2 and 15.3, and I also turned on "treat warnings as errors". Can you provide a sample project that demonstrates the behavior you are seeing?

mbrandonw commented 7 months ago

Hi @PatrickDanino, I still haven't been able to reproduce this, so I am going to convert this to a discussion for now. Please feel free to continue the conversation over there if you uncover something new.