Files
swift-mirror/test/NameBinding/protocol-inheritance.swift
Slava Pestov 8541811edf AST: Fix ProtocolDecl::getInheritedProtocols() for protocols that inherit from compositions
We allow protocols to inherit from protocol compositions
defined via a typealias, eg,

typealias PQ = P & Q

protocol R : PQ {}

Sometimes, ProtocolDecl::getInheritedProtocols() is called before
the protocol's requirement signature has been computed. In this
case, we walk the inheritance clause of the protocol directly.
This walk was only looking at ProtocolType members of the
inheritance clause, ignoring ProtocolCompositionTypes.

As a result, name lookup could fail with an assertion because of
not being able to "see" members inherited via the protocol
composition.

Fixes <rdar://problem/32595988>.
2017-06-17 00:27:45 -07:00

6 lines
149 B
Swift

// RUN: %target-swift-frontend -typecheck -primary-file %s %S/Inputs/protocol-inheritance.swift
func kitty<Purrs>(cat: Meow<Purrs>) {
cat.pet()
}