Skip to content

Self shorthand does not work with isolated parameters #70924

@tayloraswift

Description

@tayloraswift

Description

using the Self shorthand with an isolated parameter results in error: 'isolated' parameter has non-actor type 'Self'.

Reproduction

actor A 
{
    init() {}
}
extension A 
{
    nonisolated
    func f() async
    {
-       await { (self:isolated A) in } (self)
+       await { (self:isolated Self) in } (self)
    }
}

Expected behavior

as actors do not allow inheritance, Self should be equivalent to spelling out the full type name

Environment

$ swiftc --version
Swift version 5.9.2 (swift-5.9.2-RELEASE)
Target: x86_64-unknown-linux-gnu

Additional information

forum thread: https://forums.swift.org/t/isolated-parameter-has-non-actor-type-self/69440/2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Self in classFeature → types: The 'Self' type in classesactorFeature → concurrency: `actor` declarationsbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfconcurrencyFeature: umbrella label for concurrency language featuresdeclarationsFeature: declarationsswift 6.0type checkerArea → compiler: Semantic analysistypesFeature: typesunexpected errorBug: Unexpected error

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions