File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -3840,15 +3840,20 @@ static bool isRawRepresentableGenericFunction(
38403840 ASTContext &ctx, const ValueDecl *witness,
38413841 const NormalProtocolConformance *conformance) {
38423842 auto *fnDecl = dyn_cast<AbstractFunctionDecl>(witness);
3843- return fnDecl && fnDecl->isGeneric () &&
3843+ if (!fnDecl || !fnDecl->isStdlibDecl ())
3844+ return false ;
3845+
3846+ return fnDecl->isGeneric () && fnDecl->getGenericParams ()->size () == 1 &&
3847+ fnDecl->getGenericRequirements ().size () == 2 &&
38443848 llvm::all_of (
38453849 fnDecl->getGenericRequirements (), [&](Requirement genericReq) {
3846- return genericReq.getKind () == RequirementKind::Conformance &&
3847- (genericReq.getProtocolDecl () ==
3848- ctx.getProtocol (
3849- KnownProtocolKind::RawRepresentable) ||
3850- genericReq.getProtocolDecl () ==
3851- conformance->getProtocol ());
3850+ if (genericReq.getKind () != RequirementKind::Conformance)
3851+ return false ;
3852+ return genericReq.getProtocolDecl () ==
3853+ ctx.getProtocol (
3854+ KnownProtocolKind::RawRepresentable) ||
3855+ genericReq.getProtocolDecl () ==
3856+ conformance->getProtocol ();
38523857 });
38533858}
38543859
You can’t perform that action at this time.
0 commit comments