mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
The solver's simplifyType() can produce a DependentMemberType with a concrete or archetype base, if that associated type could not be resolved during associated type inference. mapTypeOutOfContext() could assert when given a type that violates invariants in this manner. Instead, let's directly call subst() here, providing a conformance lookup function (which will probably end up returning ErrorTypes). Fixes https://bugs.swift.org/browse/SR-14672 / rdar://problem/78626943.
24 lines
530 B
Swift
24 lines
530 B
Swift
// RUN: %target-swift-frontend -emit-ir %s
|
|
|
|
public protocol PublicContent {
|
|
associatedtype Model
|
|
init(_ model: Model)
|
|
}
|
|
|
|
public protocol PublicConvertible {
|
|
associatedtype Public
|
|
func toPublic() -> Public
|
|
}
|
|
|
|
extension PublicConvertible where Public: PublicContent, Public.Model == Self {
|
|
public func toPublic() -> Public {
|
|
Public(self)
|
|
}
|
|
}
|
|
|
|
extension Array: PublicConvertible where Element: PublicConvertible {
|
|
public func toPublic() -> [Element.Public] {
|
|
map { $0.toPublic() }
|
|
}
|
|
}
|