You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
cc @milseman. The actual behavior we want here is that @escaping is a property of the parameter, not the function type, but we don't currently allow you to write @escaping on typealiases. I think there's another JIRA or Radar for that.
I thought this was an actual bug, but in fact in TypeCheckType.cpp, we resolve function types differently if they appear inside another function context. This seems inconsistent and weird. It would be better to allow @escaping on type alias types, as Jordan said.
The thing that seemed broken to me is that whether a parameter's type is declared with or without using a typealias impacts whether or not the parameter gets the default @NoEscape.
The block parameter for bogus_error is considered to be @escaping, but the one for works_fine is considered to be @NoEscape. I would have expected both to be @NoEscape.
Attachment: Download
Additional Detail from JIRA
md5: baffa86c07d4e4507700b040d298e309
duplicates:
is duplicated by:
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).
The text was updated successfully, but these errors were encountered: