@@ -185,11 +185,33 @@ struct LiteralRequirement {
185
185
CoveredBy = coveredBy;
186
186
}
187
187
188
- bool isCoveredBy (Type type, DeclContext *useDC) const ;
188
+ // / Determines whether this literal requirement is "covered"
189
+ // / by the given binding - type of the binding could either be
190
+ // / equal (in canonical sense) to the protocol's default type,
191
+ // / or conform to a protocol.
192
+ // /
193
+ // / \param binding The binding to check for coverage.
194
+ // /
195
+ // / \param canBeNil The flag that determines whether given type
196
+ // / variable requires all of its bindings to be optional.
197
+ // /
198
+ // / \param useDC The declaration context in which this literal
199
+ // / requirement is used.
200
+ // /
201
+ // / \returns a pair of bool and a type:
202
+ // / - bool, true if binding covers given literal protocol;
203
+ // / - type, non-null if binding type has to be adjusted
204
+ // / to cover given literal protocol;
205
+ std::pair<bool , Type> isCoveredBy (const PotentialBinding &binding,
206
+ bool canBeNil,
207
+ DeclContext *useDC) const ;
189
208
190
209
// / Determines whether literal protocol associated with this
191
210
// / meta-information is viable for inclusion as a defaultable binding.
192
211
bool viableAsBinding () const { return !isCovered () && hasDefaultType (); }
212
+
213
+ private:
214
+ bool isCoveredBy (Type type, DeclContext *useDC) const ;
193
215
};
194
216
195
217
struct PotentialBindings {
@@ -392,26 +414,6 @@ struct PotentialBindings {
392
414
393
415
void addLiteral (Constraint *constraint);
394
416
395
- // / Determines whether the given literal protocol is "covered"
396
- // / by the given binding - type of the binding could either be
397
- // / equal (in canonical sense) to the protocol's default type,
398
- // / or conform to a protocol.
399
- // /
400
- // / \param literal The literal protocol requirement to check.
401
- // /
402
- // / \param binding The binding to check for coverage.
403
- // /
404
- // / \param canBeNil The flag that determines whether given type
405
- // / variable requires all of its bindings to be optional.
406
- // /
407
- // / \returns a pair of bool and a type:
408
- // / - bool, true if binding covers given literal protocol;
409
- // / - type, non-null if binding type has to be adjusted
410
- // / to cover given literal protocol;
411
- std::pair<bool , Type> isLiteralCoveredBy (const LiteralRequirement &literal,
412
- const PotentialBinding &binding,
413
- bool canBeNil) const ;
414
-
415
417
// / Add a potential binding to the list of bindings,
416
418
// / coalescing supertype bounds when we are able to compute the meet.
417
419
void addPotentialBinding (PotentialBinding binding, bool allowJoinMeet = true );
0 commit comments