You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inference and type checking within functions such as
func max<T: Comparable>(_ x: T, _ y: T) -> T {
return x > y ? x : y
}
can be implemented with a creation of a "fake" concrete type T, which has all members of Comparable protocol copied into it. Then inference of func max could run as if T is a type constructor of a concrete type, not a generic parameter.
The text was updated successfully, but these errors were encountered:
Inference and type checking within functions such as
can be implemented with a creation of a "fake" concrete type
T
, which has all members ofComparable
protocol copied into it. Then inference offunc max
could run as ifT
is a type constructor of a concrete type, not a generic parameter.The text was updated successfully, but these errors were encountered: