Skip to content

Commit fca7d36

Browse files
committed
[Sema] Use the deployment target as minimum OS version in swiftinterfaces
Preserve the previous behavior when parsing swiftinterfaces as the Swift stdlib for Swift 5.3 and a few other swiftinterfaces in Xcode 12.0 had issues that would now be reported as errors.
1 parent 1ca852e commit fca7d36

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/Sema/TypeCheckAvailability.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,13 @@ class TypeRefinementContextBuilder : private ASTWalker {
179179
// When the body is inlinable consider only the explicitly declared range
180180
// for checking availability. Otherwise, use the parent range which may
181181
// begin at the minimum deployment target.
182+
//
183+
// Also use the parent range when reading swiftinterfaces for
184+
// retrocompatibility.
182185
bool isInlinable = D->getAttrs().hasAttribute<InlinableAttr>() ||
183186
D->getAttrs().hasAttribute<AlwaysEmitIntoClientAttr>();
184-
if (!isInlinable)) {
187+
SourceFile *SF = D->getDeclContext()->getParentSourceFile();
188+
if (!isInlinable || (SF && SF->Kind == SourceFileKind::Interface)) {
185189
DeclInfo.intersectWith(
186190
getCurrentTRC()->getAvailabilityInfo());
187191
}

0 commit comments

Comments
 (0)