Skip to content

Commit f1ba749

Browse files
authored
Merge pull request #14119 from rudkx/rdar36798061-4.1
[4.1] Do not assert on @objc (Name) extension FancyName {}
2 parents 41ca788 + 7146454 commit f1ba749

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
@@ -9159,7 +9159,8 @@ static void validateAttributes(TypeChecker &TC, Decl *D) {
91599159
// appropriate.
91609160
if (auto objcName = objcAttr->getName()) {
91619161
if (isa<ClassDecl>(D) || isa<ProtocolDecl>(D) || isa<VarDecl>(D)
9162-
|| isa<EnumDecl>(D) || isa<EnumElementDecl>(D)) {
9162+
|| isa<EnumDecl>(D) || isa<EnumElementDecl>(D)
9163+
|| isa<ExtensionDecl>(D)) {
91639164
// Types and properties can only have nullary
91649165
// names. Complain and recover by chopping off everything
91659166
// 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)