Address review feedback

This commit is contained in:
Arnold Schwaighofer
2019-04-29 07:34:46 -07:00
parent ef78844349
commit 768d1c51a1
12 changed files with 225 additions and 221 deletions

View File

@@ -109,11 +109,6 @@ public:
LookupConformanceFn conformances,
SubstOptions options = None) const;
/// Replace opaque types in the conforming type with their underlying types,
/// and resolve opaque conformances to their underlying conformances.
ProtocolConformanceRef substOpaqueTypesWithUnderlyingTypes(
Type origType, ModuleDecl *modulePerformingSubstitution) const;
/// Given a dependent type (expressed in terms of this conformance's
/// protocol), follow it from the conforming type.
Type getAssociatedType(Type origType, Type dependentType,

View File

@@ -175,11 +175,6 @@ public:
LookupConformanceFn conformances,
SubstOptions options = None) const;
/// Replace opaque types in the replacement types in the map with their
/// underlying types. Does not change keys.
SubstitutionMap substOpaqueTypesWithUnderlyingTypes(
ModuleDecl *modulePerformingSubstitution) const;
/// Create a substitution map for a protocol conformance.
static SubstitutionMap
getProtocolSubstitutions(ProtocolDecl *protocol,

View File

@@ -316,11 +316,6 @@ public:
/// Replace references to substitutable types with error types.
Type substDependentTypesWithErrorTypes() const;
/// Replace opaque types with their underlying types when visible at the given
/// resilience expansion.
Type substOpaqueTypesWithUnderlyingTypes(
ModuleDecl *modulePerformingSubstitution) const;
bool isPrivateStdlibType(bool treatNonBuiltinProtocolsAsPublic = true) const;
void dump() const;

View File

@@ -4821,26 +4821,6 @@ private:
BEGIN_CAN_TYPE_WRAPPER(OpaqueTypeArchetypeType, ArchetypeType)
END_CAN_TYPE_WRAPPER(OpaqueTypeArchetypeType, ArchetypeType)
/// A function object that can be used as a \c TypeSubstitutionFn and
/// \c LookupConformanceFn for \c Type::subst style APIs to map opaque
/// archetypes with underlying types visible at a given resilience expansion
/// to their underlying types.
class ReplaceOpaqueTypesWithUnderlyingTypes {
public:
ModuleDecl *modulePerformingSubstitution;
ReplaceOpaqueTypesWithUnderlyingTypes(
ModuleDecl *modulePerformingSubstitution)
: modulePerformingSubstitution(modulePerformingSubstitution) {}
/// TypeSubstitutionFn
Type operator()(SubstitutableType *maybeOpaqueType) const;
/// LookupConformanceFn
Optional<ProtocolConformanceRef> operator()(CanType maybeOpaqueType,
Type replacementType,
ProtocolDecl *protocol) const;
};
/// An archetype that represents the dynamic type of an opened existential.
class OpenedArchetypeType final : public ArchetypeType,
private ArchetypeTrailingObjects<OpenedArchetypeType>

View File

@@ -109,11 +109,7 @@ class TypeSubstCloner : public SILClonerWithScopes<ImplClass> {
assert(Subs.empty() ||
SubstCalleeSILType ==
Callee->getType().substGenericArgs(AI.getModule(), Subs) ||
(Cloner.ReplacingOpaqueArchetypes &&
SubstCalleeSILType ==
Cloner.getOpType(Callee->getType().substGenericArgs(
AI.getModule(), Subs))));
Callee->getType().substGenericArgs(AI.getModule(), Subs));
}
ArrayRef<SILValue> getArguments() const {
@@ -159,14 +155,12 @@ public:
TypeSubstCloner(SILFunction &To,
SILFunction &From,
SubstitutionMap ApplySubs,
bool Inlining = false,
bool ReplacingOpaqueArchetypes = false)
bool Inlining = false)
: SILClonerWithScopes<ImplClass>(To, Inlining),
SwiftMod(From.getModule().getSwiftModule()),
SubsMap(ApplySubs),
Original(From),
Inlining(Inlining),
ReplacingOpaqueArchetypes(ReplacingOpaqueArchetypes) {
Inlining(Inlining) {
}
protected:
@@ -387,8 +381,6 @@ protected:
SILFunction &Original;
/// True, if used for inlining.
bool Inlining;
/// True if replacing opaque result archetypes.
bool ReplacingOpaqueArchetypes;
};
} // end namespace swift