In the following fragment:
func foo(escaping: @escaping () -> (), nonescaping: () -> ()) {
let a = escaping // ok
let b = nonescaping // ok
print(type(of: a)) // () -> ()
print(type(of: b)) // () -> ()
let c: () -> () = escaping // ok
let d: () -> () = nonescaping // π Using non-escaping parameter 'nonescaping' in a context expecting an @escaping closure
}
foo(escaping: {}, nonescaping: {})
both escaping and non escaping closure types are printed as () -> ()
, although this is apparently not the whole story and if I use this type in the explicit type position of a variable declaration the type doesn't match the nonescaping parameter. Is this type inexpressible in Swift?