Skip to content

Commit d40d47f

Browse files
authored
Fix spelling of '@available' in error message "'@Availability' attribute cannot be applied to this declaration" (swiftlang#29760)
* Update DAK_Available name to match @available keyword Update expected errors for @available attribute tests * Update available attribute keyword name in DeclAttrKeyword documentation comment
1 parent f4cef57 commit d40d47f

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

include/swift/IDE/CodeCompletion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class CodeCompletionStringChunk {
6666
/// "open", "public", "internal", "fileprivate", or "private".
6767
AccessControlKeyword,
6868

69-
/// such as @"availability".
69+
/// such as @"available".
7070
DeclAttrKeyword,
7171

7272
/// such as "unavailable" etc. for @available.

lib/AST/Attr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,7 @@ StringRef DeclAttribute::getAttrName() const {
10881088
case DAK_Semantics:
10891089
return "_semantics";
10901090
case DAK_Available:
1091-
return "availability";
1091+
return "available";
10921092
case DAK_ObjC:
10931093
case DAK_ObjCRuntimeName:
10941094
return "objc";

test/Parse/invalid.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ let x: () = ()
134134
!x // expected-error {{cannot convert value of type '()' to expected argument type 'Bool'}}
135135

136136
func sr8202_foo(@NSApplicationMain x: Int) {} // expected-error {{@NSApplicationMain may only be used on 'class' declarations}}
137-
func sr8202_bar(@available(iOS, deprecated: 0) x: Int) {} // expected-error {{'@availability' attribute cannot be applied to this declaration}}
137+
func sr8202_bar(@available(iOS, deprecated: 0) x: Int) {} // expected-error {{'@available' attribute cannot be applied to this declaration}}
138138
func sr8202_baz(@discardableResult x: Int) {} // expected-error {{'@discardableResult' attribute cannot be applied to this declaration}}
139139
func sr8202_qux(@objcMembers x: String) {} // expected-error {{@objcMembers may only be used on 'class' declarations}}
140140
func sr8202_quux(@weak x: String) {} // expected-error {{'weak' is a declaration modifier, not an attribute}} expected-error {{'weak' may only be used on 'var' declarations}}
@@ -143,5 +143,5 @@ class sr8202_cls<@NSApplicationMain T: AnyObject> {} // expected-error {{@NSAppl
143143
func sr8202_func<@discardableResult T>(x: T) {} // expected-error {{'@discardableResult' attribute cannot be applied to this declaration}}
144144
enum sr8202_enum<@indirect T> {} // expected-error {{'indirect' is a declaration modifier, not an attribute}} expected-error {{'indirect' modifier cannot be applied to this declaration}}
145145
protocol P {
146-
@available(swift, introduced: 4.2) associatedtype Assoc // expected-error {{'@availability' attribute cannot be applied to this declaration}}
146+
@available(swift, introduced: 4.2) associatedtype Assoc // expected-error {{'@available' attribute cannot be applied to this declaration}}
147147
}

0 commit comments

Comments
 (0)