Skip to content

Commit 617e851

Browse files
authored
Merge pull request swiftlang#72094 from beccadax/objcimpl-generated-header-override
2 parents e2d33ec + bcdbeb4 commit 617e851

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

lib/PrintAsClang/DeclAndTypePrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2845,7 +2845,7 @@ static bool excludeForObjCImplementation(const ValueDecl *VD) {
28452845
return true;
28462846
// Exclude overrides in an @_objcImplementation extension; the decl they're
28472847
// overriding is declared elsewhere.
2848-
if (VD->isImplicit() && VD->getOverriddenDecl()) {
2848+
if (VD->getOverriddenDecl()) {
28492849
auto ED = dyn_cast<ExtensionDecl>(VD->getDeclContext());
28502850
if (ED && ED->isObjCImplementation())
28512851
return true;

test/PrintAsObjC/Inputs/custom-modules/objc_implementation/objc_implementation.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@
66

77
@end
88

9+
@interface ObjCClass2 : NSObject
10+
11+
@end
12+
913
void CImplFunc(void);

test/PrintAsObjC/objc_implementation.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,18 @@ extension ObjCClass {
3030
// Implicit `override init()` to override superclass
3131

3232
// NEGATIVE-NOT: )swiftMethod{{ }}
33-
@objc func swiftMethod() -> Any? { nil }
33+
@objc public func swiftMethod() -> Any? { nil }
3434

3535
// NEGATIVE-NOT: )privateMethod{{ }}
3636
@objc private func privateMethod() -> Any? { nil }
3737
}
3838

39+
// Has no contents that need to be printed
40+
// NEGATIVE-NOT: ObjCClass2
41+
@_objcImplementation extension ObjCClass2 {
42+
// NEGATIVE-NOT: )init{{ }}
43+
public override init() { }
44+
}
45+
3946
@_cdecl("CImplFunc") @_objcImplementation func CImplFunc() {}
4047
// NEGATIVE-NOT: CImplFunc(

0 commit comments

Comments
 (0)