The reason for this is that when a protocol is used as a type constraint, the compiler can make assumptions about the properties and methods that the conforming type will have. When a generic type is nested within another generic type, the compiler has to account for the fact that the nested type may have its own set of type constraints and conditions, which can make it more difficult to predict the behavior of the enclosing type. Additionally, the compiler may not be able to infer the types of the enclosed type, which can lead to errors when attempting to assign values to it. Therefore, the Swift compiler may be unable to assign to a type constrained by a protocol when it is enclosed within a different generic type.
Asked: 2023-06-19 06:53:18 +0000
Seen: 16 times
Last updated: Jun 19 '23