swift-book
swift-book copied to clipboard
Requirement inference is not documented
Location
No response
Description
This code type checks and infers T: Hashable:
func foo<T>(_: Set<T>) {}
A more complex example; we infer T.Element: Hashable:
func foo<T: Sequence>(_: T) -> Set<Array<T.Element>> {}
I couldn't find mention of this behavior anywhere in TSPL.
Motivation
No response
Alternatives Considered
No response