Files
swift-mirror/test/multifile/Inputs/protocol-conformance/rdar31302713.swift
Slava Pestov f10f00d887 Sema: Narrow fix for a circular protocol conformance checking case
We go to look at the conforming protocols of an associated type
but we haven't built the generic environment for the associated
type's protocol yet.

In the test case given, we find the conformance later via a
different path, so everything continues to work.

SubstitutionMap::lookupConformance() is hopefully getting a
makeover soon, and this hack will go away.

Fixes <rdar://problem/31302713>.
2017-03-30 02:03:52 -07:00

25 lines
519 B
Swift

public protocol Animal {
associatedtype AnimalSnackType : AnimalSnack
func snack(on: AnimalSnackType)
}
public protocol AnimalSnack {
associatedtype EatWith
func eat(with: EatWith)
}
extension AnimalSnack where EatWith : Animal {}
public protocol FurryAnimal : Animal {
associatedtype Fangs : Animal
func bite(with: Fangs)
}
extension FurryAnimal {
public func snack(on: FurryAnimalSnack<Self>) {}
}
public struct FurryAnimalSnack<T : FurryAnimal> : AnimalSnack {
public func eat(with: T) {}
}