@@ -210,13 +210,24 @@ static void realizeTypeRequirement(Type subjectType, Type constraintType,
210210 result.push_back ({req, loc, wasInferred});
211211}
212212
213- static void inferRequirements (Type type, SourceLoc loc,
214- SmallVectorImpl<StructuralRequirement> &result) {
213+ // / Infer requirements from applications of BoundGenericTypes to type
214+ // / parameters. For example, given a function declaration
215+ // /
216+ // / func union<T>(_ x: Set<T>, _ y: Set<T>)
217+ // /
218+ // / We automatically infer 'T : Hashable' from the fact that 'struct Set'
219+ // / declares a Hashable requirement on its generic parameter.
220+ void swift::rewriting::inferRequirements (
221+ Type type, SourceLoc loc,
222+ SmallVectorImpl<StructuralRequirement> &result) {
215223 // FIXME: Implement
216224}
217225
218- static void realizeRequirement (Requirement req, RequirementRepr *reqRepr, bool infer,
219- SmallVectorImpl<StructuralRequirement> &result) {
226+ // / Desugar a requirement and perform requirement inference if requested
227+ // / to obtain zero or more structural requirements.
228+ void swift::rewriting::realizeRequirement (
229+ Requirement req, RequirementRepr *reqRepr, bool infer,
230+ SmallVectorImpl<StructuralRequirement> &result) {
220231 auto firstType = req.getFirstType ();
221232 if (infer) {
222233 auto firstLoc = (reqRepr ? reqRepr->getFirstTypeRepr ()->getStartLoc ()
@@ -269,8 +280,11 @@ static void realizeRequirement(Requirement req, RequirementRepr *reqRepr, bool i
269280 }
270281}
271282
272- static void realizeInheritedRequirements (TypeDecl *decl, Type type, bool infer,
273- SmallVectorImpl<StructuralRequirement> &result) {
283+ // / Collect structural requirements written in the inheritance clause of an
284+ // / AssociatedTypeDecl or GenericTypeParamDecl.
285+ void swift::rewriting::realizeInheritedRequirements (
286+ TypeDecl *decl, Type type, bool infer,
287+ SmallVectorImpl<StructuralRequirement> &result) {
274288 auto &ctx = decl->getASTContext ();
275289 auto inheritedTypes = decl->getInherited ();
276290
0 commit comments