Avatar
@swift-5.1.5 @swift-5.0.3 protocol A { func isEquatable() -> Bool } extension A { func isEquatable() -> Bool { return false } } extension A where Self: Equatable { func isEquatable() -> Bool { return true } } struct Foo: A { } extension String: A { } print(Foo().isEquatable()) print(String().isEquatable()) (edited)