diff --git a/lib/Sema/TypeCheckProtocol.cpp b/lib/Sema/TypeCheckProtocol.cpp
index df98939..37c1c03 100644
--- a/lib/Sema/TypeCheckProtocol.cpp
+++ b/lib/Sema/TypeCheckProtocol.cpp
@@ -4417,6 +4411,11 @@ static bool isUnsatisfiedReq(NormalProtocolConformance *conformance,
       !conformance->getWitness(req, nullptr).getDecl())
     return req->getAttrs().hasAttribute<OptionalAttr>();
 
+  // The witness might come from a protocol or protocol extension.
+  if (conformance->getWitness(req, nullptr).getDecl()->getDeclContext()
+        ->getAsProtocolOrProtocolExtensionContext())
+    return true;
+
   return false;
 }
 
