Skip to content

[SR-2316] typealias for block type not defaulting to @noescape #44923

@swift-ci

Description

@swift-ci
Previous ID SR-2316
Radar None
Original Reporter dgrove-oss (JIRA User)
Type Bug
Status Closed
Resolution Duplicate

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee @slavapestov
Priority Medium

md5: baffa86c07d4e4507700b040d298e309

duplicates:

  • SR-2053 [Regression] Using @NoEscape for a type aliased closure results in a compile error

is duplicated by:

  • SR-2355 Typealias and escaping
  • SR-2493 Escaping and Type-aliases don't work together
  • SR-2522 Function attribute @escaping does not apply to function type aliases

Issue 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 

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itself

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions