Skip to content

[Changelog] Add a note about conformance synthesis in same-file extensions. #16666

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
May 17, 2018

Conversation

huonw
Copy link
Contributor

@huonw huonw commented May 17, 2018

No description provided.

@huonw
Copy link
Contributor Author

huonw commented May 17, 2018

@swift-ci please smoke test

Copy link
Contributor

@jrose-apple jrose-apple left a comment

Choose a reason for hiding this comment

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

LGTM

CHANGELOG.md Outdated
Code that wants to be as precise as possible should generally not
conditionally conform to `Codable` directly, but rather its two constituent
protocols, or else one can only (for instance) decode a `Generic<Param>` if
`Param` is `Encodable` in additional to the `Decodable`:
Copy link
Contributor

Choose a reason for hiding this comment

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

additional?

CHANGELOG.md Outdated
@@ -57,6 +57,40 @@ Swift 5.0
Swift 4.2
---------

* [SE-0185][]

Protocol conformances can now be synthesized in extensions in the same file as
Copy link
Contributor

Choose a reason for hiding this comment

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

"can now be" -> "are now"

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think "can" is right here: the synthesis doesn't always happen.

CHANGELOG.md Outdated
struct Generic<Param> {
var property: Param
}
extension Generic: Equatable where Param: Equatable {}
Copy link
Contributor

Choose a reason for hiding this comment

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

If this last part is the auto-synthesized part, it's not clear. You could put it into a comment with something like:
// Automatically synthesized:
// extension Generic...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added:

// Automatically synthesized inside the extension:
// static func ==(lhs: Generic, rhs: Generic) -> Bool {
//   return lhs.property == rhs.property
// }

CHANGELOG.md Outdated

Code that wants to be as precise as possible should generally not
conditionally conform to `Codable` directly, but rather its two constituent
protocols, or else one can only (for instance) decode a `Generic<Param>` if
Copy link
Contributor

Choose a reason for hiding this comment

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

"two constituent protocols" -> "two constituent protocols Foo and Bar"

where Foo and Bar are the constituent protocols...

@huonw huonw force-pushed the conf-ext-synth-changelog branch from 31c8a09 to d4a9d51 Compare May 17, 2018 01:10
@huonw
Copy link
Contributor Author

huonw commented May 17, 2018

@swift-ci please smoke test

@huonw huonw merged commit 4e30a31 into swiftlang:master May 17, 2018
@huonw huonw deleted the conf-ext-synth-changelog branch May 17, 2018 06:05
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.

3 participants