Skip to content

Commit b3f8147

Browse files
committed
[Docs] Fix typo in GenericsManifesto.md.
Minor clarification to "opening existentials" example.
1 parent 12bb4ef commit b3f8147

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/GenericsManifesto.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -757,8 +757,8 @@ if e1 == e2 { ... } // error: e1 and e2 don't necessarily have the same dynamic
757757
One explicit way to allow such operations in a type-safe manner is to introduce an "open existential" operation of some sort, which extracts and gives a name to the dynamic type stored inside an existential. For example:
758758

759759
```Swift
760-
if let storedInE1 = e1 openas T { // T is a the type of storedInE1, a copy of the value stored in e1
761-
if let storedInE2 = e2 as? T { // is e2 also a T?
760+
if let storedInE1 = e1 openas T { // T is the type of storedInE1, a copy of the value stored in e1
761+
if let storedInE2 = e2 as? T { // does e2 have type T? if so, copy its value to storedInE2
762762
if storedInE1 == storedInE2 { ... } // okay: storedInT1 and storedInE2 are both of type T, which we know is Equatable
763763
}
764764
}

0 commit comments

Comments
 (0)