Skip to content

[SR-4637] Add fix-it for removing '@escaping' from optional closure parameter #47214

Closed
@swift-ci

Description

@swift-ci
Previous ID SR-4637
Radar None
Original Reporter garricn (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

Xcode 8.3.1, Swift 3.1

Additional Detail from JIRA
Votes 2
Component/s Compiler
Labels Bug, StarterBug
Assignee ismetanin (JIRA)
Priority Medium

md5: ea3ce9103e3b95d06baa97059732e723

Issue Description:

As of SR-2444, optional closures as function parameters are already escaping escaping by default. Currently, when adding the @escaping attribute to an optional closure parameter, the compiler throws the following error:

@escaping attribute only applies to function types

Since this type is already escaping escaping by default, it would be helpful to add / amend the error as follows:

Optional closures are already @escaping.

And add the following Fix-it:

Fix-it Delete "@escaping"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfgood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions