Skip to content

Commit 3375b36

Browse files
committed
Search nested types tables in parent modules
Add another cross-cutting module configuration to the nested types table search path. A module can have no overlay but also contain a nested types table suitable for finding a given member name. UIKit is the sharpest example of this state of affairs. UIKit currently defines an overlay in Swift where we find some nested types. But it also defines an inner module that has some other nested types tables. Resolves rdar://58940989
1 parent a34b044 commit 3375b36

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/Serialization/Deserialization.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,6 +1468,10 @@ ModuleFile::resolveCrossReference(ModuleID MID, uint32_t pathLen) {
14681468
if (auto overlayModule = LF->getOverlayModule()) {
14691469
nestedType = findNestedTypeDeclInModule(getFile(), overlayModule,
14701470
memberName, baseType);
1471+
} else if (LF->getParentModule() != extensionModule) {
1472+
nestedType = findNestedTypeDeclInModule(getFile(),
1473+
LF->getParentModule(),
1474+
memberName, baseType);
14711475
}
14721476
}
14731477
}

test/Serialization/multi-file-nested-type-extension.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// REQUIRES: asserts
1111

1212
// CHECK: Statistics
13-
// CHECK: 1 Serialization - # of nested types resolved without full lookup
13+
// CHECK: 2 Serialization - # of nested types resolved without full lookup
1414

1515
// Note the Optional here and below; this was once necessary to produce a crash.
1616
// Without it, the type of the parameter is initialized "early" enough to not
@@ -21,3 +21,9 @@ extension Outer {
2121

2222
public func useTypes(_: Outer.Callback?) {}
2323
}
24+
25+
extension OuterClass.Inner {
26+
public static var instance: OuterClass.Inner {
27+
return OuterClass.Inner()
28+
}
29+
}

0 commit comments

Comments
 (0)