Skip to content

Commit 400e761

Browse files
authored
Merge pull request #38877 from nkcsgexi/81903124-5.5
[5.5] ModuleInterface: avoid omitting platform names when printing @available
2 parents bc25e45 + a25231f commit 400e761

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
@@ -425,7 +425,9 @@ static void printShortFormAvailable(ArrayRef<const DeclAttribute *> Attrs,
425425
for (auto *DA : Attrs) {
426426
auto *AvailAttr = cast<AvailableAttr>(DA);
427427
assert(AvailAttr->Introduced.hasValue());
428-
if (isShortFormAvailabilityImpliedByOther(AvailAttr, Attrs))
428+
// Avoid omitting available attribute when we are printing module interface.
429+
if (!Options.IsForSwiftInterface &&
430+
isShortFormAvailabilityImpliedByOther(AvailAttr, Attrs))
429431
continue;
430432
Printer << platformString(AvailAttr->Platform) << " "
431433
<< 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)