Skip to content

[SR-5556] @escaping Diagnostics Should Always Offer a Fixit #48128

@CodaFi

Description

@CodaFi
Previous ID SR-5556
Radar None
Original Reporter @CodaFi
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI
Assignee mkchoi212 (JIRA)
Priority Medium

md5: 4f14ea42d651469b5c1a49e8c94f02a5

is duplicated by:

  • SR-5455 Compiler not able to provide automatic fix-it for returning closure

Issue Description:

The following code

func mapping <A, B, C> (f: (A) -> (B)) -> (((C, B) -> (C))) -> ((C, A) -> (C)) {
  return { reducer in
    return { accum, input in
      reducer(accum, f(input))
    }
  }
}

Should suggest that we insert @escaping in two places such that the final signature is

func mapping <A, B, C> (f: @escaping (A) -> (B)) -> (@escaping ((C, B) -> (C))) -> ((C, A) -> (C))

However, it only chooses to offer a fixit for the leftmost @escaping and reports the rightmost one as escaping without a fixit. We should diagnose both consistently and offer a fixit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfdiagnostics QoIBug: Diagnostics Quality of Implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions