Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-15282] Using an actor with NSObject conformance on Linux #3200

Open
mickeyl opened this issue Oct 5, 2021 · 2 comments
Open

[SR-15282] Using an actor with NSObject conformance on Linux #3200

mickeyl opened this issue Oct 5, 2021 · 2 comments

Comments

@mickeyl
Copy link

@mickeyl mickeyl commented Oct 5, 2021

Previous ID SR-15282
Radar rdar://problem/83878042
Original Reporter @mickeyl
Type Bug
Environment

Swift 5.5, Linux.

Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug, Concurrency
Assignee None
Priority Medium

md5: 75d39d970ff122b78002957b1976920f

Issue Description:

I have a {{public actor StreamCommandQueue: NSObject }}, which implements StreamDelegate, hence I have to derive from NSObject.

On Apple platforms, that works fine. On Linux I get the error:

error: actor-isolated initializer 'init()' has different actor isolation from nonisolated overridden declarationpublic actor StreamCommandQueue: NSObject { Foundation.NSObject:2:12: note: overridden declaration is here public init()

Why the difference and how am I supposed to fix that?

@ktoso
Copy link
Member

@ktoso ktoso commented Oct 5, 2021

Thanks for reporting, we'll have a look - at first look it seems it might be a bug, initializers are not really intended to be isolated.

You could try overriding with `nonisolated init()` as workaround ?

@swift-ci create

@mickeyl
Copy link
Author

@mickeyl mickeyl commented Oct 7, 2021

@ktoso Unfortunately that doesn't work:

error: nonisolated initializer 'init()' has different actor isolation from nonisolated overridden declaration
 override nonisolated init() {
 ^
Foundation.NSObject:2:12: note: overridden declaration is here
 public init()

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants