[SR-629] Protocol composition types should be covariant with composing protocols for protocol conformance #43246
Labels
compiler
The Swift compiler in itself
conformances
Feature → protocol: protocol conformances
duplicate
Resolution: Duplicates another issue
feature
A feature request or implementation
improvement
protocol
Feature → type declarations: Protocol declarations
type checker
Area → compiler: Semantic analysis
Environment
Mac OS 10.11.1 (15B42)
Xcode 7.2 (7C68)
Additional Detail from JIRA
md5: d960735cf0599949e4c6f4948a07a6d4
duplicates:
relates to:
Issue Description:
The type
protocol<A,B>
should be treated as covariant with the typeA
since all types conforming toprotocol<A,B>
conform toA
.This works for function calling:
However, it does not work for protocol conformance. Given
A
andB
above, I expect the following to compile, but it does not:Similarly, I expect function return values to work as well, but this does not compile:
The text was updated successfully, but these errors were encountered: