[SR-11868] Unable to rename protocol associatedtype through inheritance #54282
Labels
compiler
The Swift compiler in itself
conformances
Feature → protocol: protocol conformances
generics
Feature: generic declarations and types
improvement
type checker
Area → compiler: Semantic analysis
Environment
MacOS 10.15, XCode 11.2.
Additional Detail from JIRA
md5: 5c2da9f9df69e7952aa7afdd24d2008a
Issue Description:
If I have protocol Old with associatedtype OldType, I may want to define protocol New with associatedtype NewType that inherits Old and provides NewType for OldType. My first attempt at this fails unexpectedly:
There's both a warning:
Typealias overriding associated type 'OldType' from protocol 'Old' is better expressed as same-type constraint on the protocol
and Impl fails to compile with
Type 'Impl' does not conform to protocol 'New' Type 'Impl' does not conform to protocol 'Old'
This appears to work:
except there is the same warning as above in the extension and the extension itself should be unnecessary. That makes me think the first approach should work, and the warning is incorrect since there is already a where clause on the protocol.
The text was updated successfully, but these errors were encountered: