-
Notifications
You must be signed in to change notification settings - Fork 10.5k
stdlib: Collapse some multi-line closures to single-line closures. #15730
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The change in CheckMutableCollectionType.swift.gyb previously resulted in a runtime failure, and before that a compiler crash. It appears that whatever type checker bug(s) were causing the issue have been resolved in the last few months, so I'm returning this closure to a single-expression form and cleaning up a couple other places where we had an unneeded temporary as well. Resolves rdar://problem/33781464.
@swift-ci Please smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! It looks there were resolved by fixing binding priority related to subtype constraints.
@@ -446,8 +446,7 @@ self.test("\(testNamePrefix)._withUnsafeMutableBufferPointerIfSupported()/semant | |||
var c = makeWrappedCollection(test.collection) | |||
var result = c._withUnsafeMutableBufferPointerIfSupported { | |||
(bufferPointer) -> OpaqueValue<Array<OpaqueValue<Int>>> in | |||
let value = OpaqueValue(bufferPointer.map(extractValue)) | |||
return value | |||
return OpaqueValue(bufferPointer.map(extractValue)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
N.B. This is still not a single expression closure though, because it has a return statement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@slavapestov These are still considered to be single expression closures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like everyone else on the team, I am still learning Swift. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change in
CheckMutableCollectionType.swift.gyb
previously resultedin a runtime failure, and before that a compiler crash.
It appears that whatever type checker bug(s) were causing the issue
have been resolved in the last few months, so I'm returning this
closure to a single-expression form and cleaning up a couple other
places where we had an unneeded temporary as well.
Resolves rdar://problem/33781464.