mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
IsBindableVisitor is part of TypeBase::substituteBindingsTo(), which is used for two things: - Checking if one contextual type is a proper substitution of another contextual type, used in the solver - To compute the substituted generic signature when lowering a SIL function type In the first case, we're interested in knowing if the substitution succeeds or fails. In the second case, we know the substitution is correct by construction, and we're trying to recover the generic requirements. In the second case though, the substituted type might be an interface type, and if the interface type is constrained to a concrete type in the original type's generic signature, we would conclude that the substitution should fail. This is incorrect, and we should just skip the check if the substituted type is an interface type -- we do not have enough information to know if it succeeds, and instead we must assume it does because otherwise the substituted type passed in to type lowering must be incorrect. Fixes https://bugs.swift.org/browse/SR-13849.
14 lines
235 B
Swift
14 lines
235 B
Swift
// RUN: %target-swift-frontend -emit-ir %s
|
|
|
|
public protocol Prot {
|
|
associatedtype T
|
|
}
|
|
|
|
public class C<P: Prot> where P.T: Hashable {
|
|
}
|
|
|
|
public class Spam<P: Prot> where P.T == Int {
|
|
public func m(_ f: (C<P>) -> C<P>) {
|
|
}
|
|
}
|