   return x.foo()
 }
 
-func shouldOptimize2(_ x: ClassD & ProtocolD) -> Int {
+func shouldOptimize2(_ x: ClassD & ProtocolA) -> Int {
   return x.foo()
 }
 
-func shouldOptimize3(_ x: ProtocolE & ProtocolG) -> Int {
+func shouldOptimize3(_ x: ProtocolA & ProtocolB) -> Int {
   return x.foo() + x.bar()
 }
 
-func shouldOptimize4(_ x: ProtocolF & ProtocolH) -> Int {
+func shouldOptimize4(_ x: ProtocolA & ProtocolB) -> Int {
   return x.foo() + x.bar()
 }
 
-func shouldOptimize5(_ x: ClassH.type & ProtocolD) -> Int {
+func shouldOptimize5(_ x: ClassH.type & ProtocolA) -> Int {
   return x.foo()
 }
 

  }
}

extension ClassF: ProtocolE, ProtocolG { }

public class ClassG <T> {
  func foo() -> Int {

}

protocol ProtocolB {
  func bar() -> Int
}

