Skip to content

Commit 0ffca8b

Browse files
authored
Merge pull request #14120 from rudkx/rdar36798061-5.0
2 parents 4aec94c + f48cca1 commit 0ffca8b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/Sema/TypeCheckDecl.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9158,7 +9158,8 @@ static void validateAttributes(TypeChecker &TC, Decl *D) {
91589158
// appropriate.
91599159
if (auto objcName = objcAttr->getName()) {
91609160
if (isa<ClassDecl>(D) || isa<ProtocolDecl>(D) || isa<VarDecl>(D)
9161-
|| isa<EnumDecl>(D) || isa<EnumElementDecl>(D)) {
9161+
|| isa<EnumDecl>(D) || isa<EnumElementDecl>(D)
9162+
|| isa<ExtensionDecl>(D)) {
91629163
// Types and properties can only have nullary
91639164
// names. Complain and recover by chopping off everything
91649165
// after the first name.

test/attr/attr_objc.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ protocol Protocol_Class2 : class {}
3232

3333
@objc extension PlainStruct { } // expected-error{{'@objc' can only be applied to an extension of a class}}{{1-7=}}
3434

35+
class FáncyName {}
36+
@objc (FancyName) extension FáncyName {}
37+
3538
@objc
3639
var subject_globalVar: Int // expected-error {{@objc can only be used with members of classes, @objc protocols, and concrete extensions of classes}}
3740

0 commit comments

Comments
 (0)