Skip to content

Commit 575b7fb

Browse files
authored
Merge pull request swiftlang#35296 from xymus/fix-define-avail-sourcekit
[Sema] Fix storage of availability macros definition for SourceKit
2 parents 7e6536d + e3bdc62 commit 575b7fb

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ namespace swift {
116116
std::string RequireExplicitAvailabilityTarget;
117117

118118
// Availability macros definitions to be expanded at parsing.
119-
SmallVector<StringRef, 4> AvailabilityMacros;
119+
SmallVector<std::string, 4> AvailabilityMacros;
120120

121121
/// If false, '#file' evaluates to the full path rather than a
122122
/// human-readable string.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// RUN: %sourcekitd-test -req=sema %s -- %s \
2+
// RUN: -Xfrontend -define-availability \
3+
// RUN: -Xfrontend "_iOS8Aligned:macOS 10.10, iOS 8.0" | %FileCheck %s
4+
5+
// REQUIRES: OS=macosx
6+
7+
// Should fail.
8+
@available(_iOS9Aligned, *)
9+
public func onMacOS10_11() {}
10+
// CHECK: key.line: 8
11+
// CHECK: key.description: "expected 'available' option such as 'unavailable', 'introduced', 'deprecated', 'obsoleted', 'message', or 'renamed'"
12+
// CHECK: key.line: 8
13+
// CHECK: key.description: "expected declaration"
14+
15+
// Should be OK.
16+
@available(_iOS8Aligned, *)
17+
public func onMacOS10_10() {}
18+
// CHECK-NOT: key.line

0 commit comments

Comments
 (0)