Skip to content

Commit 592e2f7

Browse files
committed
Sema: Correctly simplify member types with a DynamicSelfType base
Fixes <https://bugs.swift.org/browse/SR-10434>, <rdar://problem/49779783>.
1 parent 3c04923 commit 592e2f7

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/Sema/ConstraintSystem.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2197,7 +2197,8 @@ Type simplifyTypeImpl(ConstraintSystem &cs, Type type, Fn getFixedTypeFn) {
21972197
// through lvalue, inout and IUO types here
21982198
Type lookupBaseType = newBase->getWithoutSpecifierType();
21992199

2200-
if (lookupBaseType->mayHaveMembers()) {
2200+
if (lookupBaseType->mayHaveMembers() ||
2201+
lookupBaseType->is<DynamicSelfType>()) {
22012202
auto *proto = assocType->getProtocol();
22022203
auto conformance = cs.DC->getParentModule()->lookupConformance(
22032204
lookupBaseType, proto);

test/decl/func/dynamic_self.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,18 +320,24 @@ func testOptionalSelf(_ y : Y) {
320320
// Conformance lookup on Self
321321

322322
protocol Runcible {
323+
associatedtype Runcer
323324
}
324325

325326
extension Runcible {
326327
func runce() {}
328+
329+
func runced(_: Runcer) {}
327330
}
328331

329332
func wantsRuncible<T : Runcible>(_: T) {}
330333

331334
class Runce : Runcible {
335+
typealias Runcer = Int
336+
332337
func getRunced() -> Self {
333338
runce()
334339
wantsRuncible(self)
340+
runced(3)
335341
return self
336342
}
337343
}

0 commit comments

Comments
 (0)