[SR-7014] Protocol with associated type, conforming with inherited protocol not supported? #49562
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
conformances
Feature → protocol: protocol conformances
feature
A feature request or implementation
type checker
Area → compiler: Semantic analysis
Attachment: Download
Environment
Version 9.2 (9C40b)
Version 9.3 beta 2 (9Q107o)
Additional Detail from JIRA
md5: 739e1ec6d472d9d86106f459ee676496
Issue Description:
Hi all,
Really unsure whether or not this is a bug, limitation, or I'm doing something stupid, but I've tried hard to resolve this and this seems like something that should be supported, but is not. Code:
I have a protocol that will be used to abstract some layout behaviour. It should work for any child view controller, but in the concrete implementation (
ViewController
) I would still like to haveheaderViewController
expressed using a protocol (which as far as I can see, correctly inherits from the base protocol). This does not work, however:The odd part is the middle error:
possibly intended match 'ViewController.HeaderViewController' (aka 'MapViewController') does not conform to 'ContentViewController'
. However, in my implementation theMapViewController
protocol certainly does inherit fromContentViewController
. So it would seem that conforming to the protocol with a subtype of the protocol is not supported. This seems like it should work. I would like to use an extension toContainerTabbleViewController
to do the layout, which would only rely on the availability of theview
property, which is expressed inContentViewController
. Then, in the context ofViewController
I ought to be able to refer to the characteristics of my protocol subtype, providing it inherits from the correct protocol to satisfyContainerTabbleViewController
Apologies in advance if I'm making an error here, but this certainly seems wrong and ought to be supported. Many thanks!
The text was updated successfully, but these errors were encountered: