the version of the documentation site running on https://swiftinit.org/reference/swift/
regurgitates the swiftExtension.constraints
field of the corresponding symbolgraph vertex.
grepping the raw symbolgraph emitted from the compiler, it looks like SymbolGraphGen includes ReversedCollection
’s generic constraints in the extension block constraints of all its extension block members:
{
"kind": {
"identifier": "swift.method",
"displayName": "Instance Method"
},
"identifier": {
"precise": "s:s18ReversedCollectionV8reversedxyF",
"interfaceLanguage": "swift"
},
"pathComponents": [
"ReversedCollection",
"reversed()"
],
"names": {
"title": "reversed()",
"subHeading": [
{
"kind": "keyword",
"spelling": "func"
},
{
"kind": "text",
"spelling": " "
},
{
"kind": "identifier",
"spelling": "reversed"
},
{
"kind": "text",
"spelling": "() -> "
},
{
"kind": "typeIdentifier",
"spelling": "Base"
}
]
},
"docComment": {
"lines": [
{
"text": "Reversing a reversed collection returns the original collection."
},
{
"text": ""
},
{
"text": "- Complexity: O(1)"
}
]
},
"functionSignature": {
"returns": [
{
"kind": "typeIdentifier",
"spelling": "Base"
}
]
},
"swiftGenerics": {
"parameters": [
{
"name": "Base",
"index": 0,
"depth": 0
}
],
"constraints": [
{
"kind": "conformance",
"lhs": "Base",
"rhs": "BidirectionalCollection",
"rhsPrecise": "s:SK"
}
]
},
"swiftExtension": {
"extendedModule": "Swift",
"constraints": [
{
"kind": "conformance",
"lhs": "Base",
"rhs": "BidirectionalCollection",
"rhsPrecise": "s:SK"
}
]
},
"declarationFragments": [
{
"kind": "keyword",
"spelling": "func"
},
{
"kind": "text",
"spelling": " "
},
{
"kind": "identifier",
"spelling": "reversed"
},
{
"kind": "text",
"spelling": "() -> "
},
{
"kind": "typeIdentifier",
"spelling": "Base"
}
],
"accessLevel": "public",
"availability": [
{
"domain": "Swift",
"introduced": {
"major": 4,
"minor": 2
}
}
]
}
i don’t know if this is intended behavior. but it doesn’t seem particularly useful. it should appear in swiftGenerics
only.