Skip to content

[Question] Is it possible to declare Protocol with actor inheritance and @MainActor #64383

Open
@fummicc1

Description

@fummicc1

Description

a protocol with actor inheritance can be annotated by @MainActor but it is not possible in my understanding.

  • example code
// this protocol can pass compilation though I can't declare actor which conform to `B`.
@MainActor
protocol B: Actor {}

Steps to reproduce

  • running above example code and check xcode can compile this code.

Expected behavior

I hope swift will say error against above code.

Environment

  • Swift compiler version info: swift 5.7.2
  • Xcode version info: Xcode 14.2
  • Deployment target: iOS 13

Metadata

Metadata

Assignees

No one assigned

    Labels

    actorFeature → concurrency: `actor` declarationsbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfconcurrencyFeature: umbrella label for concurrency language featuresdiagnostics QoIBug: Diagnostics Quality of Implementationmissing warningBug: Missing warningprotocolFeature → type declarations: Protocol declarationsswift 5.7

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions