mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
When an archetype conforms to a protocol abstractly (ie, it is
not class-constrained and we don't have any further information
other than that it conforms), we can recover nested types,
but we cannot recover the conformance of those nested types
to protocols if those conformances are concrete (the nested
type might be concrete, or it might be a class-constrained
archetype).
To work around this, we added a hack where if the conformance
lookup in the SubstitutionMap fails, we fall back to the module.
This is horrible and unprincipled, but has to remain in place
until more infrastructure is plumbed through.
Commit 620db5f74c made this
workaround apply in fewer cases, so that we could still catch
cases where the SubstitutionMap was constructed with missing
conformances.
Unfortunately this workaround didn't handle the case where the
nested type was an archetype with a superclass constraint.
This will all go away soon, but for now tweak the logic a bit,
since I really want to keep the "narrow" workaround in place
and not the general fallback, otherwise we run the risk of
SubstitutionMap conformance lookup bitrotting completely.
Fixes <https://bugs.swift.org/browse/SR-4088> and
<rdar://problem/32773028>.
24 lines
570 B
Swift
24 lines
570 B
Swift
// RUN: %target-swift-frontend -emit-ir -primary-file %s
|
|
|
|
class UITableViewCell {}
|
|
class UITableView {}
|
|
|
|
extension UITableViewCell: ReusableViewProtocol {
|
|
public typealias ParentView = UITableView
|
|
}
|
|
|
|
protocol ReusableViewProtocol {
|
|
associatedtype ParentView
|
|
}
|
|
|
|
protocol ReusableViewFactoryProtocol {
|
|
associatedtype View: ReusableViewProtocol
|
|
func configure(parentView: View.ParentView)
|
|
}
|
|
|
|
extension ReusableViewFactoryProtocol where View: UITableViewCell {
|
|
func tableCellFor(tableView: UITableView) {
|
|
configure(parentView: tableView)
|
|
}
|
|
}
|