Skip to content

Commit a2ee7f2

Browse files
committed
[CSApply] Simplify handling of static member refs on protocol metatype
1 parent b27fd2b commit a2ee7f2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/Sema/CSApply.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,10 +1189,12 @@ namespace {
11891189
// Here `P.foo` would be replaced with `S.foo`
11901190
if (!isExistentialMetatype && baseTy->is<ProtocolType>() &&
11911191
member->isStatic()) {
1192+
auto selfParam =
1193+
overload.openedFullType->castTo<FunctionType>()->getParams()[0];
1194+
11921195
Type baseTy =
1193-
simplifyType(openedType->is<FunctionType>()
1194-
? openedType->castTo<FunctionType>()->getResult()
1195-
: openedType);
1196+
simplifyType(selfParam.getPlainType())->getMetatypeInstanceType();
1197+
11961198
base = TypeExpr::createImplicitHack(base->getLoc(), baseTy, context);
11971199
cs.cacheType(base);
11981200
}

0 commit comments

Comments
 (0)