Skip to content
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

Conflicting info about when to write override and required #287

Open
tadbyt opened this issue Mar 15, 2024 · 1 comment
Open

Conflicting info about when to write override and required #287

tadbyt opened this issue Mar 15, 2024 · 1 comment
Labels
Content issue A problem in with the book's prose, code, or figures

Comments

@tadbyt
Copy link
Contributor

tadbyt commented Mar 15, 2024

Location

https://docs.swift.org/swift-book/documentation/the-swift-programming-language/initialization#Required-Initializers

https://docs.swift.org/swift-book/documentation/the-swift-programming-language/protocols#Class-Implementations-of-Protocol-Initializer-Requirements

Description

In the Required Initializers subsection, the second sentence of the second paragraph reads:

You don’t write the override modifier when overriding a required designated initializer:

In the Class Implementations of Protocol Initializer Requirements, the fourth paragraph reads:

If a subclass overrides a designated initializer from a superclass, and also implements a matching initializer requirement from a protocol, mark the initializer implementation with both the required and override modifiers:

@amartini51 amartini51 added the Content issue A problem in with the book's prose, code, or figures label Mar 15, 2024
@amartini51 amartini51 changed the title Conflicting Statements Regarding required and override For Implementing Initializers Conflicting info about when to write override and required Mar 15, 2024
@amartini51
Copy link
Member

amartini51 commented Mar 15, 2024

We'll need to either find a way to test the compiler's behavior or find someone who can say, with authority, which one is correct. Normally, I'd look at who reviewed similar content recently, but the above text looks like it comes from the original Swift 1 version of TSPL in 2014, from commits 470f85e and 581ff9f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content issue A problem in with the book's prose, code, or figures
Projects
None yet
Development

No branches or pull requests

2 participants