Skip to content

Commit 633b63b

Browse files
committed
[SILGen] Remove a vestigial use of getSelfTypeInContext().
1 parent bcde656 commit 633b63b

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

lib/SILGen/SILGenApply.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,6 @@ replaceSelfTypeForDynamicLookup(ASTContext &ctx,
8686
ctx);
8787
}
8888

89-
static Type getExistentialArchetype(SILValue existential) {
90-
CanType ty = existential->getType().getSwiftRValueType();
91-
if (ty->is<ArchetypeType>())
92-
return ty;
93-
return cast<ProtocolType>(ty)->getDecl()->getSelfTypeInContext();
94-
}
95-
9689
/// Retrieve the type to use for a method found via dynamic lookup.
9790
static CanSILFunctionType getDynamicMethodLoweredType(SILGenFunction &gen,
9891
SILValue proto,
@@ -103,7 +96,8 @@ static CanSILFunctionType getDynamicMethodLoweredType(SILGenFunction &gen,
10396
// Determine the opaque 'self' parameter type.
10497
CanType selfTy;
10598
if (methodName.getDecl()->isInstanceMember()) {
106-
selfTy = getExistentialArchetype(proto)->getCanonicalType();
99+
selfTy = proto->getType().getSwiftRValueType();
100+
assert(selfTy->is<ArchetypeType>() && "Dynamic lookup needs an archetype");
107101
} else {
108102
selfTy = proto->getType().getSwiftType();
109103
}

0 commit comments

Comments
 (0)