@@ -69,9 +69,49 @@ namespace {
69
69
// / generic requirements. See the \c Witness class for more information about
70
70
// / this synthetic environment.
71
71
class RequirementEnvironment {
72
+ // / A generic signature that combines the generic parameters of the
73
+ // / concrete conforming type with the generic parameters of the
74
+ // / requirement.
75
+ // /
76
+ // /
77
+ // / For example, if you have:
78
+ // /
79
+ // / protocol P { func f<T>(_: T) }
80
+ // / struct S<A, B> : P { func f<T>(_: T) }
81
+ // /
82
+ // / The requirement and witness signatures are, respectively:
83
+ // /
84
+ // / <Self : P, T>
85
+ // / <A, B, T>
86
+ // /
87
+ // / The synthetic signature in this case is just the witness signature.
88
+ // /
89
+ // / It may be that the witness is more generic than the requirement,
90
+ // / for example:
91
+ // /
92
+ // / protocol P { func f(_: Int) }
93
+ // / struct S<A, B> : P { func f<T>(_: T) { } }
94
+ // /
95
+ // / Here, the requirement signature and witness signatures are:
96
+ // /
97
+ // / <Self : P>
98
+ // / <A, B, T>
99
+ // /
100
+ // / The synthetic signature is just:
101
+ // /
102
+ // / <A, B>
103
+ // /
104
+ // / The witness thunk emitted by SILGen uses the synthetic signature.
105
+ // / Therefore one invariant we preserve is that the witness thunk is
106
+ // / ABI compatible with the requirement's function type.
72
107
GenericSignature *syntheticSignature = nullptr ;
73
108
GenericEnvironment *syntheticEnvironment = nullptr ;
109
+
110
+ // / The generic signature of the protocol requirement member.
74
111
GenericSignature *reqSig = nullptr ;
112
+
113
+ // / A substitution map mapping the requirement signature to the
114
+ // / generic parameters of the synthetic signature.
75
115
SubstitutionMap reqToSyntheticEnvMap;
76
116
77
117
public:
0 commit comments