Skip to content

Compiler mistakes referencing an actor method for applying that method #85718

@rayx

Description

@rayx

Description

actor A {
    func dumpSignature() {
        print(type(of: Self.dumpSignature)) // error: call to actor-isolated instance method 'dumpSignature()' in a synchronous nonisolated context [#ActorIsolatedCall]
        let fn = Self.dumpSignature  // same error as above
    }
}

In contrast, GAIT works fine.

@globalActor
actor MyGlobal {
    static let shared = MyGlobal()
}

@MyGlobal
struct S {
    func dumpSignature() {
        print(type(of: Self.dumpSignature)) // OK
    }
}

Reproduction

See above

Expected behavior

The first example should compile.

Environment

x86-64 swiftc nightly on godbolt

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions