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
Comparing the output of the following two functions, the version that switches over a tuple forms the tuple in memory even though it's never used in aggregate. The compiler should be able to optimize the tuple away completely, since it is only formed, switched upon, and deconstructed.
public func tuple<T: Equatable>(a: T?, b: T?) -> Bool {
switch (a, b) {
case (nil, nil): return true
case (.some(let x), .some(let y)): return x == y
default: break
}
return false
}
public func nested<T: Equatable>(a: T?, b: T?) -> Bool {
switch a {
case nil:
switch b {
case nil: return true
default: break
}
case .some(let x):
switch b {
case .some(let y): return x == y
default: break
}
}
return false
}
The text was updated successfully, but these errors were encountered:
Additional Detail from JIRA
md5: a79f917a0c3cfcae0dcddba3f764690b
Issue Description:
Comparing the output of the following two functions, the version that switches over a tuple forms the tuple in memory even though it's never used in aggregate. The compiler should be able to optimize the tuple away completely, since it is only formed, switched upon, and deconstructed.
The text was updated successfully, but these errors were encountered: