Skip to content

UseShorthandTypeNames incorrect with Sendable functions #657

Closed
@PeterAdams-A

Description

@PeterAdams-A

If I start with the code

var a: Optional< @Sendable (Int) -> (Float)> = nil

and apply swift-format format --parallel --recursive --in-place Sources version 509.0.0 the code becomes

var a: @Sendable (Int) -> (Float)? = nil

The optionalness has moved from the whole phrase to just the return type. This has a different meaning. The new code doesn't compile because of this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions