Skip to content

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

Merged
merged 1 commit into from
Apr 4, 2018
Merged

stdlib: Collapse some multi-line closures to single-line closures. #15730

merged 1 commit into from
Apr 4, 2018

Conversation

rudkx
Copy link
Contributor

@rudkx rudkx commented Apr 4, 2018

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.

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.
@rudkx rudkx requested a review from moiseev April 4, 2018 05:30
@rudkx
Copy link
Contributor Author

rudkx commented Apr 4, 2018

@swift-ci Please smoke test

Copy link
Contributor

@xedin xedin left a 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))
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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. :)

Copy link
Contributor

@moiseev moiseev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@rudkx rudkx merged commit e137da5 into swiftlang:master Apr 4, 2018
@rudkx rudkx deleted the rdar33781464 branch April 4, 2018 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants