Skip to content

Commit d44d264

Browse files
authored
Merge pull request #38874 from nkcsgexi/81903124
ModuleInterface: avoid omitting platform names when printing @available
2 parents b572194 + c2e4e86 commit d44d264

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/AST/Attr.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,9 @@ static void printShortFormAvailable(ArrayRef<const DeclAttribute *> Attrs,
457457
for (auto *DA : Attrs) {
458458
auto *AvailAttr = cast<AvailableAttr>(DA);
459459
assert(AvailAttr->Introduced.hasValue());
460-
if (isShortFormAvailabilityImpliedByOther(AvailAttr, Attrs))
460+
// Avoid omitting available attribute when we are printing module interface.
461+
if (!Options.IsForSwiftInterface &&
462+
isShortFormAvailabilityImpliedByOther(AvailAttr, Attrs))
461463
continue;
462464
Printer << platformString(AvailAttr->Platform) << " "
463465
<< AvailAttr->Introduced.getValue().getAsString() << ", ";
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: echo '@available(macOS 12.0, iOS 15.0, macCatalyst 15.0, *)' > %t/Foo.swift
3+
// RUN: echo 'public struct Foo {}' >> %t/Foo.swift
4+
5+
// RUN: %target-swift-frontend -emit-module -emit-module-interface-path %t/Foo.swiftinterface -enable-library-evolution %t/Foo.swift
6+
// RUN: %FileCheck %s < %t/Foo.swiftinterface
7+
8+
// CHECK: macCatalyst

0 commit comments

Comments
 (0)