Skip to content

Distributed: incorrect diagnostics for missing import #59172

Open
@MaxDesiatov

Description

@MaxDesiatov

Describe the bug
When import Distributed is missing in a file which has distributed actor with distributed func in it, an seemingly unrelated error messages are produced:

error: type 'Greeter' does not conform to protocol 'Equatable'
...
<unknown>:0: error: cannot find '__isRemoteActor' in scope
<unknown>:0: error: cannot find 'RemoteCallTarget' in scope

To Reproduce

  1. Create a file with this content (assuming an implementation YourClusterSystem of DistributedActorSystem is in scope)
typealias DefaultDistributedActorSystem = YourClusterSystem

distributed actor Greeter {
    distributed func hello() {
        print("Hello, Distributed World!")
    }
}
  1. Try to build and observe unrelated error messages that don't mention the missing import.
  2. Adding import Distributed in such file makes the errors go away.

Expected behavior
If import Distributed is always needed in files that contain distributed actors, an error message that requires the import should be displayed. Unrelated diagnostics about missing Equatable conformance shouldn't be displayed as it's confusing.

Environment:
OS: macOS 12.4 (21F79), but most likely reproducible on any platform that supports distributed actors.
Xcode Version/Tag/Branch: 13.4 (13F17a)
Toolchain: Swift Development Snapshot 2022-05-27, also reproducible with 5.7 Development Snapshot 2022-05-18 (a)

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.distributedFeature → concurrency: distributed actor

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions