You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"'@objc' can only be applied to an extension of a class", ())
6419
6419
6420
+
ERROR(objc_name_not_valid_identifier,none,
6421
+
"'@objc' %0 name is not a valid Objective-C identifier",
6422
+
(DescriptiveDeclKind))
6423
+
ERROR(objc_cannot_infer_name_raw_identifier,none,
6424
+
"cannot infer '@objc' %0 name because the Swift name is not a valid "
6425
+
"Objective-C identifier; specify the name in '@objc' explicitly",
6426
+
(DescriptiveDeclKind))
6427
+
6420
6428
// If you change this, also change enum ObjCReason
6421
6429
#defineOBJC_ATTR_SELECT"select{marked @_cdecl|marked dynamic|marked @objc|marked @objcMembers|marked @IBOutlet|marked @IBAction|marked @IBSegueAction|marked @NSManaged|a member of an @objc protocol|implicitly @objc|an @objc override|an implementation of an @objc requirement|marked @IBInspectable|marked @GKInspectable|in an @objc extension of a class (without @nonobjc)|in an @objc @implementation extension of a class (without final or @nonobjc)|marked @objc by an access note}"
@objc(`Foo Bar`) publicclassFooBar{ // expected-error {{'@objc' class name is not a valid Objective-C identifier}}
7
+
@objcfunc `function with spaces`() {} // expected-error {{cannot infer '@objc' instance method name because the Swift name is not a valid Objective-C identifier; specify the name in '@objc' explicitly}}
8
+
9
+
@objc(for)func forFunction1(){}
10
+
@objc(`while`)func whileFunction(){}
11
+
publicfunc `not exported`() {}
12
+
}
13
+
14
+
@objc@objcMemberspublicclass `Class with Spaces` { // expected-error {{cannot infer '@objc' class name because the Swift name is not a valid Objective-C identifier; specify the name in '@objc' explicitly}}
15
+
publicvar `this is exported`: Int =0 // expected-error {{cannot infer '@objc' property name because the Swift name is not a valid Objective-C identifier; specify the name in '@objc' explicitly}}
16
+
17
+
publicvar `another var`: Int { // expected-error {{cannot infer '@objc' property name because the Swift name is not a valid Objective-C identifier; specify the name in '@objc' explicitly}}
18
+
get{0}
19
+
set{}
20
+
}
21
+
22
+
publicvar `yet another var`: Int { // expected-error {{cannot infer '@objc' property name because the Swift name is not a valid Objective-C identifier; specify the name in '@objc' explicitly}}
23
+
@objc(`yet another getter`) get {0} // expected-error {{'@objc' getter name is not a valid Objective-C identifier}}
24
+
@objc(`yet another setter`:) set {} // expected-error {{'@objc' setter name is not a valid Objective-C identifier}}
25
+
}
26
+
27
+
public func `also exported`() {} // expected-error {{cannot infer '@objc' instance method name because the Swift name is not a valid Objective-C identifier; specify the name in '@objc' explicitly}}
28
+
29
+
public init(){}
30
+
31
+
public init(`label with space`: Int){} // expected-error {{cannot infer '@objc' initializer name because the Swift name is not a valid Objective-C identifier; specify the name in '@objc' explicitly}}
32
+
33
+
public init(goodLabel `internal name`: Int){}
34
+
}
35
+
36
+
@objc class NormalObjCClass {}
37
+
38
+
class `Inherits from Objective-C Class`: NormalObjCClass { // expected-error {{cannot infer '@objc' class name because the Swift name is not a valid Objective-C identifier; specify the name in '@objc' explicitly}}
39
+
}
40
+
41
+
@objc protocol `Some Protocol` { // expected-error {{cannot infer '@objc' protocol name because the Swift name is not a valid Objective-C identifier; specify the name in '@objc' explicitly}}
42
+
}
43
+
44
+
@objc enum `Some Enum`: Int { // expected-error {{cannot infer '@objc' enum name because the Swift name is not a valid Objective-C identifier; specify the name in '@objc' explicitly}}
45
+
case `some case A` // expected-error {{cannot infer '@objc' enum case name because the Swift name is not a valid Objective-C identifier; specify the name in '@objc' explicitly}}
46
+
@objc(someCaseB) case `some case B`
47
+
@objc(`some case C`) case `some case C` // expected-error {{'@objc' enum case name is not a valid Objective-C identifier}}
48
+
}
49
+
50
+
@objcenumEnumNameIsOK:Int{
51
+
case `raw identifier` // expected-error {{cannot infer '@objc' enum case name because the Swift name is not a valid Objective-C identifier; specify the name in '@objc' explicitly}}
0 commit comments