Uploaded image for project: 'Swift'
  1. Swift
  2. SR-2316

typealias for block type not defaulting to @noescape

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Duplicate
    • Component/s: Compiler
    • Labels:
      None

      Description

      Test case attached. When cleaning up the Dispatch overlay for Linux I observed that a typealias for a closure type did not pick up the default @noescape annotation. As a result, the attached test case does not compile (but should).

      dgrove@dgrove-vb-swift:~/swift/tests$ swiftc NoEscape.swift 
      NoEscape.swift:7:4: error: closure use of non-escaping parameter 'block' may allow it to escape
                block(y)
                ^
      NoEscape.swift:4:10: note: parameter 'block' is implicitly non-escaping
      func foo(block:(Int)->Void) {
               ^
                     @escaping 
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                slavapestov Slava Pestov
                Reporter:
                dgrove-oss David Grove
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: