Skip to content

Commit 3a8483e

Browse files
committed
Prevent calling getClassOrBoundGenericClass twice
1 parent aa4db79 commit 3a8483e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/SILGen/SILGenExpr.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3399,10 +3399,10 @@ static ManagedValue emitKeyPathRValueBase(SILGenFunction &subSGF,
33993399

34003400
// Upcast a class instance to the property's declared type if necessary.
34013401
if (auto propertyClass = storage->getDeclContext()->getSelfClassDecl()) {
3402+
if (auto selfType = baseType->getAs<DynamicSelfType>())
3403+
baseType = selfType->getSelfType()->getCanonicalType();
34023404
auto baseClass = baseType->getClassOrBoundGenericClass();
3403-
if (auto dynamicSelfType = baseType->getAs<DynamicSelfType>()) {
3404-
baseClass = dynamicSelfType->getSelfType()->getClassOrBoundGenericClass();
3405-
}
3405+
34063406
if (baseClass != propertyClass) {
34073407
baseType = baseType->getSuperclassForDecl(propertyClass)
34083408
->getCanonicalType();

0 commit comments

Comments
 (0)