Skip to content

Commit 5fed0ea

Browse files
committed
AST: Replace a getSelfInterfaceType() with TheSelfType
1 parent ca223d6 commit 5fed0ea

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

lib/AST/RequirementEnvironment.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,13 @@ RequirementEnvironment::RequirementEnvironment(
8585
// parameters of the requirement into a combined context that provides the
8686
// type parameters of the conformance context and the parameters of the
8787
// requirement.
88-
auto selfType = cast<GenericTypeParamType>(
89-
proto->getSelfInterfaceType()->getCanonicalType());
90-
9188
reqToWitnessThunkSigMap = SubstitutionMap::get(reqSig,
92-
[selfType, substConcreteType, depth, covariantSelf, &ctx]
89+
[substConcreteType, depth, covariantSelf, &ctx]
9390
(SubstitutableType *type) -> Type {
9491
// If the conforming type is a class, the protocol 'Self' maps to
9592
// the class-constrained 'Self'. Otherwise, it maps to the concrete
9693
// type.
97-
if (type->isEqual(selfType)) {
94+
if (type->isEqual(ctx.TheSelfType)) {
9895
if (covariantSelf)
9996
return ctx.TheSelfType;
10097
return substConcreteType;
@@ -114,11 +111,11 @@ RequirementEnvironment::RequirementEnvironment(
114111
}
115112
return substGenericParam;
116113
},
117-
[selfType, substConcreteType, conformance, conformanceDC, covariantSelf, &ctx](
114+
[substConcreteType, conformance, conformanceDC, covariantSelf, &ctx](
118115
CanType type, Type replacement, ProtocolDecl *proto)
119116
-> ProtocolConformanceRef {
120117
// The protocol 'Self' conforms concretely to the conforming type.
121-
if (type->isEqual(selfType)) {
118+
if (type->isEqual(ctx.TheSelfType)) {
122119
ASSERT(covariantSelf || replacement->isEqual(substConcreteType));
123120

124121
if (conformance) {

0 commit comments

Comments
 (0)