title: Why can't extensions with protocol conformances have a specific access level?
body: <p>Assume we have the following example code:</p>
  
  <pre><code>protocol MyProtocol {
      func someFunction()
  }
  
  public class MyClass {
  
  }
  
  public extension MyClass: MyProtocol {
      func someFunction() {
          print("hello")
      }
  }
  </code></pre>
  
  <p>Compiling the code above gives the following error:</p>
  
  <blockquote>
    <p>Error: 'public' modifier cannot be used with extensions that declare protocol conformances</p>
  </blockquote>
  
  <p>The same thing occurs if I mark the extension as <code>private</code>. It seems as though you cannot set the access level of an extension that conforms to a protocol, regardless of what the access level is set to. Even setting the protocol declaration to <code>public</code> or <code>private</code> does not remove the error.</p>
  
  <h3>Question</h3>
  
  <p>What is the reasoning for Swift restricting an extension's access level in this way if it conforms to a protocol? If the protocol conformance is applied at the class level, there is no such restriction.</p>
  
  <p>If I obey the compiler and remove the <code>private</code>/<code>public</code> designation, what is the access level of <code>someFunction()</code>?</p>
  
  <pre><code>extension MyClass: MyProtocol {
      func someFunction() {
          print("hello")
      }
  }
  </code></pre>
  
  <p>I imagine in this case it would follow the original <code>MyClass</code> implementation and be <code>public</code> but I am not sure.</p>
  
  <p>Is this behavior there because a protocol conformance in an extension means the entire class conforms to the protocol, and therefore it is redundant to re-specify the access level in the extension?</p>