diff --git a/include/swift/Sema/ConstraintSystem.h b/include/swift/Sema/ConstraintSystem.h index e14595e926b..cf911e5c724 100644 --- a/include/swift/Sema/ConstraintSystem.h +++ b/include/swift/Sema/ConstraintSystem.h @@ -1460,7 +1460,11 @@ struct MemberLookupResult { UR_ReferenceWritableKeyPathOnMutatingMember, /// This is a KeyPath whose root type is AnyObject - UR_KeyPathWithAnyObjectRootType + UR_KeyPathWithAnyObjectRootType, + + /// This is a static member being access through a protocol metatype + /// but its result type doesn't conform to this protocol. + UR_InvalidStaticMemberOnProtocolMetatype, }; /// This is a list of considered (but rejected) candidates, along with a diff --git a/lib/Sema/CSSimplify.cpp b/lib/Sema/CSSimplify.cpp index cb855bdf1f5..1322986aa63 100644 --- a/lib/Sema/CSSimplify.cpp +++ b/lib/Sema/CSSimplify.cpp @@ -7369,7 +7369,10 @@ fixMemberRef(ConstraintSystem &cs, Type baseTy, break; case MemberLookupResult::UR_KeyPathWithAnyObjectRootType: return AllowAnyObjectKeyPathRoot::create(cs, locator); - } + + case MemberLookupResult::UR_InvalidStaticMemberOnProtocolMetatype: + return AllowInvalidStaticMemberRefOnProtocolMetatype::create(cs, locator); + } } return nullptr;