Skip to content

Commit

Permalink
[Sema] Use the deployment target as minimum OS version in swiftinterf…
Browse files Browse the repository at this point in the history
…aces

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.
  • Loading branch information
xymus committed Oct 9, 2020
1 parent 1ca852e commit fca7d36
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/Sema/TypeCheckAvailability.cpp
Expand Up @@ -179,9 +179,13 @@ class TypeRefinementContextBuilder : private ASTWalker {
// When the body is inlinable consider only the explicitly declared range
// for checking availability. Otherwise, use the parent range which may
// begin at the minimum deployment target.
//
// Also use the parent range when reading swiftinterfaces for
// retrocompatibility.
bool isInlinable = D->getAttrs().hasAttribute<InlinableAttr>() ||
D->getAttrs().hasAttribute<AlwaysEmitIntoClientAttr>();
if (!isInlinable)) {
SourceFile *SF = D->getDeclContext()->getParentSourceFile();
if (!isInlinable || (SF && SF->Kind == SourceFileKind::Interface)) {
DeclInfo.intersectWith(
getCurrentTRC()->getAvailabilityInfo());
}
Expand Down

0 comments on commit fca7d36

Please sign in to comment.