Skip to content

Commit 335ae5f

Browse files
committed
Incorporate reviewer feedback
1 parent fb09435 commit 335ae5f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

userdocs/diagnostics/protocol-type-non-conformance.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ print(Cat.species) // Prints "Felis catus"
3131
print(Animal.species) // Error
3232
```
3333

34-
Since a type conforms to a protocol only when it satisfies _all_ of that protocol's requirements, the existential type `Animal` does not conform to the protocol `Animal` because it cannot satisfy its own requirement for the static property `species`:
34+
Since a type conforms to a protocol only when it satisfies _all_ of that protocol's requirements, the existential type `Animal` does not conform to the protocol `Animal` because it cannot satisfy the protocol's requirement for the static property `species`:
3535

3636
```swift
3737
func declareAnimalSpecies<T: Animal>(_ animal: T) {
@@ -54,6 +54,8 @@ Currently, even if a protocol `P` requires no initializers or static members, th
5454

5555
Concrete types that _do_ conform to protocols can provide functionality similar to that of existential types. For example, the standard library provides the `AnyHashable` type for `Hashable` values. Manual implementation of such __type erasure__ can require specific knowledge of the semantic requirements for each protocol involved and is beyond the scope of this discussion.
5656

57+
For more on using existential types, see [Protocols as Types](https://docs.swift.org/swift-book/LanguageGuide/Protocols.html#ID275) in _The Swift Programming Language_.
58+
5759
## Exceptions
5860

59-
The Swift protocol `Error` has no requirements and, when used as a type, conforms to itself; `@objc` protocols with no static requirements can also be used as types that conform to themselves.
61+
The Swift protocol `Error` has no requirements and, when used as a type, conforms to itself; `@objc` protocols with no static requirements can also be used as types that conform to themselves.

0 commit comments

Comments
 (0)