mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Update the diagostic docs so that they can be built with docc:
* Add technologyroot (diagnostics.md) to aggregate all markdown files
* Fixed warnings in a few diagnostics docs
This allows the creation of docc documentation with a single
invocation of docc. It will generate the landing page from
diagnostics.md and include all of the diagnostics as subarticles.
The subarticles are accessible via the name of the markdown file,
which is being used as the ID for these diagnostics.
E.g. existential-any.
The docc docs for these documents can be generated locally with the
following command:
>docc preview --allow-arbitrary-catalog-directories userdocs/diagnostics
25 lines
898 B
Markdown
25 lines
898 B
Markdown
# `ExistentialAny`
|
|
|
|
This diagnostic group includes errors and warnings pertaining to the `any` type
|
|
syntax.
|
|
|
|
This syntax was proposed in [SE-0335](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0335-existential-any.md).
|
|
`any` syntax draws a line between constraint types and existential or boxed
|
|
types.
|
|
|
|
For example, `any Collection` is a boxed type abstracting over a value of a
|
|
dynamic type that conforms to the protocol `Collection`, whereas the
|
|
`Collection` part is the conformance constraint imposed on the type of the
|
|
underlying value *as well as* a constraint type.
|
|
The distinction between a conformance constraint and a constraint type can be
|
|
clearly seen in classic generic syntax: `<T: Collection>`.
|
|
|
|
Constraint types exist to express conformances and have no meaning in relation
|
|
to values.
|
|
|
|
```swift
|
|
func sillyFunction(collection: Collection) { // error
|
|
// ...
|
|
}
|
|
```
|