Skip to content

Commit 5e12e26

Browse files
committed
Sema: Adjust dynamic member subscript diagnostic in swiftinterfaces.
Only warn in `.swiftinterface` files since there may be existing resilient libraries that were built with this mistake previously. Resolves rdar://157318951.
1 parent e3d381b commit 5e12e26

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/Sema/TypeCheckAttr.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2158,8 +2158,10 @@ visitDynamicMemberLookupAttr(DynamicMemberLookupAttr *attr) {
21582158
bool shouldError = ctx.isSwiftVersionAtLeast(futureVersion);
21592159

21602160
// Diagnose as an error in resilient modules regardless of language
2161-
// version since this will break the swiftinterface.
2162-
shouldError |= decl->getModuleContext()->isResilient();
2161+
// version since this will break the swiftinterface. Don't diagnose
2162+
// cases in existing swiftinterface files, though.
2163+
shouldError |= decl->getModuleContext()->isResilient() &&
2164+
!decl->getDeclContext()->isInSwiftinterface();
21632165

21642166
auto diag = diagnose(inaccessibleCandidate->getLoc(),
21652167
diag::dynamic_member_lookup_candidate_inaccessible,

0 commit comments

Comments
 (0)