Files
swift-mirror/test/Generics/runaway_conformance_access_path.swift
Slava Pestov e6ff771d59 GSB: Rewrite getConformanceAccessPath(), again
The new approach is to not look at RequirementSources at all. Instead,
we exhaustively enumerate all conformance access paths, beginning
from the root conformance requirements in the signature, then doing
all conformance requirements from those protocols' requirement
signatures, and so on.

We enumerate conformance access paths in breadth first order by
length until we find the one we want. The results are memoized.

This fixes a regression with another change I'm working on. The
test case does not fail with this PR alone, but I'm adding it now
anyway.
2021-05-06 17:55:43 -04:00

22 lines
689 B
Swift

// RUN: %target-swift-frontend -typecheck -debug-generic-signatures %s 2>&1 | %FileCheck %s
// RUN: %target-swift-frontend -emit-ir -verify %s
// Reduced from swift-futures project in the source compatibility suite.
public protocol FutureProtocol: FutureConvertible where FutureType == Self {
associatedtype Output
}
public protocol FutureConvertible {
associatedtype FutureType: FutureProtocol
}
func takesFuture<T : FutureProtocol>(_: T.Type) {}
public struct FutureHolder<T : FutureProtocol> {
// CHECK-LABEL: Generic signature: <T, U where T == U.FutureType, U : FutureConvertible>
init<U : FutureConvertible>(_: U) where U.FutureType == T {
takesFuture(T.self)
}
}