mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #81202 from slavapestov/lookup-conformance-fn
AST: Change signature of LookupConformanceFn
This commit is contained in:
@@ -294,9 +294,9 @@ public:
|
||||
explicit LookUpConformanceInSubstitutionMap(SubstitutionMap Subs)
|
||||
: Subs(Subs) {}
|
||||
|
||||
ProtocolConformanceRef operator()(CanType dependentType,
|
||||
Type conformingReplacementType,
|
||||
ProtocolDecl *conformedProtocol) const;
|
||||
ProtocolConformanceRef operator()(InFlightSubstitution &IFS,
|
||||
Type dependentType,
|
||||
ProtocolDecl *proto) const;
|
||||
};
|
||||
|
||||
struct OverrideSubsInfo {
|
||||
@@ -326,8 +326,8 @@ struct LookUpConformanceInOverrideSubs {
|
||||
explicit LookUpConformanceInOverrideSubs(const OverrideSubsInfo &info)
|
||||
: info(info) {}
|
||||
|
||||
ProtocolConformanceRef operator()(CanType type,
|
||||
Type substType,
|
||||
ProtocolConformanceRef operator()(InFlightSubstitution &IFS,
|
||||
Type dependentType,
|
||||
ProtocolDecl *proto) const;
|
||||
};
|
||||
|
||||
@@ -338,9 +338,9 @@ struct OuterSubstitutions {
|
||||
unsigned depth;
|
||||
|
||||
Type operator()(SubstitutableType *type) const;
|
||||
ProtocolConformanceRef operator()(CanType dependentType,
|
||||
Type conformingReplacementType,
|
||||
ProtocolDecl *conformedProtocol) const;
|
||||
ProtocolConformanceRef operator()(InFlightSubstitution &IFS,
|
||||
Type dependentType,
|
||||
ProtocolDecl *proto) const;
|
||||
};
|
||||
|
||||
} // end namespace swift
|
||||
|
||||
@@ -88,9 +88,9 @@ struct QueryTypeSubstitutionMap {
|
||||
};
|
||||
|
||||
/// Function used to resolve conformances.
|
||||
using GenericFunction = auto(CanType dependentType,
|
||||
Type conformingReplacementType,
|
||||
ProtocolDecl *conformedProtocol)
|
||||
using GenericFunction = auto(InFlightSubstitution &IFS,
|
||||
Type dependentType,
|
||||
ProtocolDecl *proto)
|
||||
-> ProtocolConformanceRef;
|
||||
using LookupConformanceFn = llvm::function_ref<GenericFunction>;
|
||||
|
||||
@@ -100,9 +100,9 @@ class LookUpConformanceInModule {
|
||||
public:
|
||||
explicit LookUpConformanceInModule() {}
|
||||
|
||||
ProtocolConformanceRef operator()(CanType dependentType,
|
||||
Type conformingReplacementType,
|
||||
ProtocolDecl *conformedProtocol) const;
|
||||
ProtocolConformanceRef operator()(InFlightSubstitution &IFS,
|
||||
Type dependentType,
|
||||
ProtocolDecl *proto) const;
|
||||
};
|
||||
|
||||
/// Functor class suitable for use as a \c LookupConformanceFn that provides
|
||||
@@ -110,9 +110,9 @@ public:
|
||||
/// type is an opaque generic type.
|
||||
class MakeAbstractConformanceForGenericType {
|
||||
public:
|
||||
ProtocolConformanceRef operator()(CanType dependentType,
|
||||
Type conformingReplacementType,
|
||||
ProtocolDecl *conformedProtocol) const;
|
||||
ProtocolConformanceRef operator()(InFlightSubstitution &IFS,
|
||||
Type dependentType,
|
||||
ProtocolDecl *proto) const;
|
||||
};
|
||||
|
||||
/// Flags that can be passed when substituting into a type.
|
||||
|
||||
@@ -7069,8 +7069,8 @@ public:
|
||||
Type operator()(SubstitutableType *maybeOpaqueType) const;
|
||||
|
||||
/// LookupConformanceFn
|
||||
ProtocolConformanceRef operator()(CanType maybeOpaqueType,
|
||||
Type replacementType,
|
||||
ProtocolConformanceRef operator()(InFlightSubstitution &IFS,
|
||||
Type maybeOpaqueType,
|
||||
ProtocolDecl *protocol) const;
|
||||
|
||||
OpaqueSubstitutionKind
|
||||
@@ -7108,8 +7108,8 @@ public:
|
||||
Type operator()(SubstitutableType *type) const;
|
||||
|
||||
/// LookupConformanceFn
|
||||
ProtocolConformanceRef operator()(CanType origType,
|
||||
Type substType,
|
||||
ProtocolConformanceRef operator()(InFlightSubstitution &IFS,
|
||||
Type origType,
|
||||
ProtocolDecl *protocol) const;
|
||||
|
||||
};
|
||||
|
||||
@@ -80,20 +80,23 @@ struct SubstitutionMapWithLocalArchetypes {
|
||||
return Type(type);
|
||||
}
|
||||
|
||||
ProtocolConformanceRef operator()(CanType origType,
|
||||
Type substType,
|
||||
ProtocolConformanceRef operator()(InFlightSubstitution &IFS,
|
||||
Type origType,
|
||||
ProtocolDecl *proto) {
|
||||
if (isa<LocalArchetypeType>(origType))
|
||||
return swift::lookupConformance(substType, proto);
|
||||
if (origType->is<LocalArchetypeType>())
|
||||
return swift::lookupConformance(origType.subst(IFS), proto);
|
||||
|
||||
if (isa<PrimaryArchetypeType>(origType) ||
|
||||
isa<PackArchetypeType>(origType))
|
||||
origType = origType->mapTypeOutOfContext()->getCanonicalType();
|
||||
if (origType->is<PrimaryArchetypeType>() ||
|
||||
origType->is<PackArchetypeType>())
|
||||
origType = origType->mapTypeOutOfContext();
|
||||
|
||||
if (SubsMap)
|
||||
return SubsMap->lookupConformance(origType, proto);
|
||||
if (SubsMap) {
|
||||
return SubsMap->lookupConformance(
|
||||
origType->getCanonicalType(), proto);
|
||||
}
|
||||
|
||||
return ProtocolConformanceRef::forAbstract(substType, proto);
|
||||
return ProtocolConformanceRef::forAbstract(
|
||||
origType.subst(IFS), proto);
|
||||
}
|
||||
|
||||
void dump(llvm::raw_ostream &out) const {
|
||||
|
||||
Reference in New Issue
Block a user