Skip to content

Linker error for nested type in @Reasync function #1

@broken-circle

Description

@broken-circle

If a function annotated with @Reasync contains a nested type declaration, the generated peer overload will not compile, since the linker attempts to reference the type declaration in the original async function.

This is a compiler issue that affects all peer, member, preamble, and body macros.

Upstream issue: swiftlang/swift#88174
Pending fix: swiftlang/swift#88898

Workaround

Declare nested types outside functions annotated with a peer, member, preamble, or body macro.

Reproduction

@Reasync
func example() async
{
    struct Local
    {
        let x: Int
    }
    
    _ = Local(x: 1)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions