Skip to content

Commit 3e8e3fb

Browse files
authored
Merge pull request #10440 from slavapestov/abstract-conformance-versus-concrete-nested-type-ugh-not-again-4.0
AST: Tweak a concrete-nested-type-of-archetype hack slightly [4.0]
2 parents 37d20f7 + 63a5f44 commit 3e8e3fb

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

lib/AST/SubstitutionMap.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,8 @@ SubstitutionMap::lookupConformance(CanType type, ProtocolDecl *proto) const {
223223
auto *M = proto->getParentModule();
224224
auto substType = type.subst(*this);
225225
if (substType &&
226-
!substType->is<ArchetypeType>() &&
226+
(!substType->is<ArchetypeType>() ||
227+
substType->castTo<ArchetypeType>()->getSuperclass()) &&
227228
!substType->isTypeParameter() &&
228229
!substType->isExistentialType()) {
229230
auto lazyResolver = M->getASTContext().getLazyResolver();
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// RUN: %target-swift-frontend -emit-ir -primary-file %s
2+
3+
class UITableViewCell {}
4+
class UITableView {}
5+
6+
extension UITableViewCell: ReusableViewProtocol {
7+
public typealias ParentView = UITableView
8+
}
9+
10+
protocol ReusableViewProtocol {
11+
associatedtype ParentView
12+
}
13+
14+
protocol ReusableViewFactoryProtocol {
15+
associatedtype View: ReusableViewProtocol
16+
func configure(parentView: View.ParentView)
17+
}
18+
19+
extension ReusableViewFactoryProtocol where View: UITableViewCell {
20+
func tableCellFor(tableView: UITableView) {
21+
configure(parentView: tableView)
22+
}
23+
}

0 commit comments

Comments
 (0)