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
Now, when I try to create function that takes a sort descriptor and inverts it, the parameter should be marked as escaping, however, the compiler doesn't detect that, and worse, disallows it:
func invert<A>(_ x: SortDescriptor<A>) -> SortDescriptor<A> {
return { l, r in !x(l, r)
}
If I define the same function without the typealias, all is well:
// Exact same function, but now it needs to be marked as escaping... (which is correct)
func invert2<A>(_ x: @escaping (A,A) -> Bool) -> (A,A) -> Bool {
return { l, r in !x(l, r)
}
I can, however, call the first function just fine:
let gte: SortDescriptor<Int> = invert(<)
The text was updated successfully, but these errors were encountered:
Additional Detail from JIRA
md5: de270f0eb69ba2760e8b414045a431b4
duplicates:
Issue Description:
I created a typealias for a sort descriptor:
typealias SortDescriptor<A> = (A, A) -> Bool
Now, when I try to create function that takes a sort descriptor and inverts it, the parameter should be marked as escaping, however, the compiler doesn't detect that, and worse, disallows it:
func invert<A>(_ x: SortDescriptor<A>) -> SortDescriptor<A> {
return { l, r in !x(l, r)
}
If I define the same function without the typealias, all is well:
// Exact same function, but now it needs to be marked as escaping... (which is correct)
func invert2<A>(_ x: @escaping (A,A) -> Bool) -> (A,A) -> Bool {
return { l, r in !x(l, r)
}
I can, however, call the first function just fine:
let gte: SortDescriptor<Int> = invert(<)
The text was updated successfully, but these errors were encountered: