Redundant conformance error using protocol composition

Hi,

protocol A {}
protocol B {}

typealias C = A & B
typealias D = A & B
typealias E = C & D

struct F: E {}

It compiles with errors: Redundant conformance of 'F' to protocol 'A'; Redundant conformance of 'F' to protocol 'B'

Using previous versions of compiler it was working fine (swift 4 - 4.2) but now it isn't. I tried it on compiler with xcode10.2 beta 4 and one of recent development 5.0 snapshots.

Is it expected behaviour with swift 5 compiler?

Did you mean a warning?

Which one? I think the newest snapshots are already far ahead Swift 5 and most likely contain Swift 5.1 changes.


If it's a warning then I think it's okay as C and D are type aliases for the exact same protocol composition, but @Slava_Pestov would know better.

It's compilation errors. I tried to set everything like "treat warning like errors" to false but it didn't help.
It tried it on swift 5.0 snapshots.

We just managed to fix this with https://github.com/apple/swift/pull/26177.

Doug

If struct F instead conforms to C and D via separate extensions I encounter the redundant conformance error using Swift 5.1.

struct F: C & D { } compiles though. Which seems to be because of the deduplication in the same line.

Is this something in the works?

Seems like a regression, : A & A does not produce a warning either.

Terms of Service

Privacy Policy

Cookie Policy