Skip to content

Commit 7f36091

Browse files
committed
Add @_objcImplementation attribute
Part of swiftlang/swift#60630, but safe to merge before the compiler-side implementation.
1 parent 892b73b commit 7f36091

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

Sources/SwiftParser/gyb_generated/DeclarationAttribute.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ extension Parser {
6464
case _staticInitializeObjCMetadata = "_staticInitializeObjCMetadata"
6565
case _restatedObjCConformance = "_restatedObjCConformance"
6666
case _typeSequence = "_typeSequence"
67+
case _objcImplementation = "_objcImplementation"
6768
case _optimize = "_optimize"
6869
case _clangImporterSynthesizedType = "_clangImporterSynthesizedType"
6970
case _weakLinked = "_weakLinked"

Sources/generate-swift-syntax-builder/gyb_syntax_support/AttributeKinds.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,11 @@ def __init__(self, name, swift_name=None):
398398
NotSerialized,
399399
ABIBreakingToAdd, ABIBreakingToRemove, APIBreakingToAdd, APIBreakingToRemove,
400400
code=71),
401-
# NOTE: 72 is unused
401+
DeclAttribute('_objcImplementation', 'ObjCImplementation',
402+
OnExtension,
403+
UserInaccessible,
404+
ABIBreakingToAdd, ABIBreakingToRemove, APIBreakingToAdd, APIBreakingToRemove,
405+
code=72),
402406
DeclAttribute('_optimize', 'Optimize',
403407
OnAbstractFunction, OnSubscript, OnVar,
404408
UserInaccessible,

Tests/SwiftParserTest/Attributes.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,4 +207,15 @@ final class AttributeTests: XCTestCase {
207207
}
208208
""")
209209
}
210+
211+
func testObjcImplementationAttribute() throws {
212+
AssertParse("""
213+
@_objcImplementation extension MyClass {
214+
func fn() {}
215+
}
216+
@_objcImplementation(Category) extension MyClass {
217+
func fn2() {}
218+
}
219+
""")
220+
}
210221
}

0 commit comments

Comments
 (0)